commit 8bdc30366cc048d3406c876b14674f5bc1dfea94 from: Stefan Sperling via: Thomas Adam date: Wed Aug 06 12:48:03 2025 UTC ensure that drops and skips get processed before keeps during commit coloring This makes repainting parent commits unnecessary and seems to avoid cases where our coloring algorithm ran into worst case performance behaviour. ok op@ commit - 5a19274d1f2108d99b338f96e8e397bc897be063 commit + 8bdc30366cc048d3406c876b14674f5bc1dfea94 blob - 64e555ba01c233deabfb7105c5e8a10004a56985 blob + 65325cf16f6257d3decf9839194c56965df6ef68 --- lib/pack_create.c +++ lib/pack_create.c @@ -1056,7 +1056,10 @@ got_pack_queue_commit_id(struct got_object_id_queue *i if (err) return err; - STAILQ_INSERT_TAIL(ids, qid, entry); + if (color == COLOR_KEEP) + STAILQ_INSERT_TAIL(ids, qid, entry); + else + STAILQ_INSERT_HEAD(ids, qid, entry); return got_pack_paint_commit(qid, color); } @@ -1208,21 +1211,21 @@ findtwixt(struct got_object_id ***res, int *nres, int goto done; } - for (i = 0; i < nhead; i++) { - struct got_object_id *id = head[i]; + for (i = 0; i < ntail; i++) { + struct got_object_id *id = tail[i]; if (id == NULL) continue; - err = queue_commit_or_tag_id(id, COLOR_KEEP, &ids, repo); + err = queue_commit_or_tag_id(id, COLOR_DROP, &ids, repo); if (err) goto done; nqueued++; } - for (i = 0; i < ntail; i++) { - struct got_object_id *id = tail[i]; + for (i = 0; i < nhead; i++) { + struct got_object_id *id = head[i]; if (id == NULL) continue; - err = queue_commit_or_tag_id(id, COLOR_DROP, &ids, repo); + err = queue_commit_or_tag_id(id, COLOR_KEEP, &ids, repo); if (err) goto done; nqueued++; blob - ec345e5b6a00f849b5cfb2a76e633b05d6215588 blob + 41a731141127c4661782ab267c82e08033542cc1 --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -1673,7 +1673,10 @@ queue_commit_id(struct got_object_id_queue *ids, struc return err; memcpy(&qid->id, id, sizeof(qid->id)); - STAILQ_INSERT_TAIL(ids, qid, entry); + if (color == COLOR_KEEP) + STAILQ_INSERT_TAIL(ids, qid, entry); + else + STAILQ_INSERT_HEAD(ids, qid, entry); return paint_commit(qid, color); }