commit 26261316a5436dcd3fedb53080ff16d7024e9fa8 from: Stefan Sperling date: Mon Aug 04 13:27:51 2025 UTC remove code which repaints parent commits from commit coloring implementation Two pack tests start failing. This will be fixed in the next commit. ok op@ commit - 9ed658f6878df9bab4f1bf752f0a769fef62a8c2 commit + 26261316a5436dcd3fedb53080ff16d7024e9fa8 blob - 00d1c1ef86ac25d4a6e1108d7eb9ce0c0bdafb04 blob + 94f873820bde5fdd4b1b29ca9800f8b59070127a --- lib/got_lib_pack_create.h +++ lib/got_lib_pack_create.h @@ -55,9 +55,6 @@ enum got_pack_findtwixt_color { const struct got_error *got_pack_paint_commit(struct got_object_qid *qid, intptr_t color); -const struct got_error *got_pack_repaint_parent_commits( - struct got_object_id *commit_id, int color, struct got_object_idset *set, - struct got_object_idset *skip, struct got_repository *repo); const struct got_error *got_pack_queue_commit_id( struct got_object_id_queue *ids, struct got_object_id *id, intptr_t color, struct got_repository *repo); blob - db7f080f5acaf39c23610da95bf5f1ab7771c2a3 blob + 5c18c0d0c0aa48b9b7041d968cfff5cd850c0232 --- lib/pack_create.c +++ lib/pack_create.c @@ -1049,87 +1049,6 @@ got_pack_paint_commit(struct got_object_qid *qid, intp } const struct got_error * -got_pack_repaint_parent_commits(struct got_object_id *commit_id, int color, - struct got_object_idset *set, struct got_object_idset *skip, - struct got_repository *repo) -{ - const struct got_error *err = NULL; - struct got_object_id_queue ids; - struct got_object_qid *qid = NULL; - struct got_commit_object *commit = NULL; - const struct got_object_id_queue *parents; - struct got_object_idset *traversed; - - STAILQ_INIT(&ids); - - traversed = got_object_idset_alloc(); - if (traversed == NULL) - return got_error_from_errno("got_object_idset_alloc"); - - err = got_object_open_as_commit(&commit, repo, commit_id); - if (err) - return err; - - while (commit) { - parents = got_object_commit_get_parent_ids(commit); - if (parents) { - struct got_object_qid *pid; - STAILQ_FOREACH(pid, parents, entry) { - /* - * No need to traverse parents which are - * already in the desired set or are - * marked for skipping already. - */ - if (got_object_idset_contains(set, &pid->id)) - continue; - if (skip != set && - got_object_idset_contains(skip, &pid->id)) - continue; - - if (got_object_idset_contains(traversed, - &pid->id)) - continue; - err = got_pack_queue_commit_id(&ids, &pid->id, - color, repo); - if (err) - break; - err = got_object_idset_add(traversed, - &pid->id, NULL); - if (err) - goto done; - } - } - got_object_commit_close(commit); - commit = NULL; - - qid = STAILQ_FIRST(&ids); - if (qid == NULL) - break; - - STAILQ_REMOVE_HEAD(&ids, entry); - err = got_object_idset_add(set, &qid->id, NULL); - if (err) - break; - - err = got_object_open_as_commit(&commit, repo, &qid->id); - if (err) - break; - - got_object_qid_free(qid); - qid = NULL; - } -done: - if (commit) - got_object_commit_close(commit); - if (qid) - got_object_qid_free(qid); - got_object_id_queue_free(&ids); - got_object_idset_free(traversed); - - return err; -} - -const struct got_error * got_pack_queue_commit_id(struct got_object_id_queue *ids, struct got_object_id *id, intptr_t color, struct got_repository *repo) { blob - 8aa23eddbb153c7e3248e919573eabc83bbaf6b3 blob + bdb095f17f945cd6f319d1b0694457d119fe85a5 --- lib/pack_create_io.c +++ lib/pack_create_io.c @@ -280,10 +280,6 @@ got_pack_paint_commits(int *ncolored, struct got_objec goto done; err = got_object_idset_add(skip, &qid->id, NULL); - if (err) - goto done; - err = got_pack_repaint_parent_commits(&qid->id, - COLOR_SKIP, skip, skip, repo); if (err) goto done; } else @@ -301,10 +297,6 @@ got_pack_paint_commits(int *ncolored, struct got_objec NULL); if (err) goto done; - err = got_pack_repaint_parent_commits(&qid->id, - COLOR_SKIP, skip, skip, repo); - if (err) - goto done; } else (*ncolored)++; err = got_object_idset_add(drop, &qid->id, NULL); blob - 84946069bb80f432199a52e1f169a0876fa81c96 blob + 2a41e8fd7c124e45e9207604dc32308d4979cd05 --- lib/pack_create_privsep.c +++ lib/pack_create_privsep.c @@ -536,10 +536,6 @@ got_pack_paint_commits(int *ncolored, struct got_objec goto done; err = got_object_idset_add(skip, &qid->id, NULL); - if (err) - goto done; - err = got_pack_repaint_parent_commits(&qid->id, - COLOR_SKIP, skip, skip, repo); if (err) goto done; } else @@ -557,10 +553,6 @@ got_pack_paint_commits(int *ncolored, struct got_objec NULL); if (err) goto done; - err = got_pack_repaint_parent_commits(&qid->id, - COLOR_SKIP, skip, skip, repo); - if (err) - goto done; } else (*ncolored)++; err = got_object_idset_add(drop, &qid->id, NULL); blob - 54c1e086ebd0bae83a20d92bc4836066049b9266 blob + 7a56d2de17d20fb18c19bcd21fa33f9be540697c --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -1681,141 +1681,6 @@ queue_commit_id(struct got_object_id_queue *ids, struc } static const struct got_error * -repaint_parent_commits(struct got_object_id *commit_id, int commit_idx, - int color, struct got_object_idset *set, struct got_object_idset *skip, - struct got_object_id_queue *ids, int *nids, - struct got_object_id_queue *painted, int *npainted, - struct got_pack *pack, struct got_packidx *packidx, - struct got_object_cache *objcache) -{ - const struct got_error *err = NULL; - const struct got_object_id_queue *parents; - struct got_commit_object *commit = NULL; - struct got_object_id_queue repaint; - struct got_object_idset *traversed; - - STAILQ_INIT(&repaint); - - traversed = got_object_idset_alloc(); - if (traversed == NULL) - return got_error_from_errno("got_object_idset_alloc"); - - err = open_commit(&commit, pack, packidx, commit_idx, commit_id, - objcache); - if (err) - return err; - - while (commit) { - struct got_object_qid *pid, *qid; - int idx; - - if (sigint_received) { - err = got_error(GOT_ERR_CANCELLED); - goto done; - } - - parents = got_object_commit_get_parent_ids(commit); - if (parents) { - STAILQ_FOREACH(pid, parents, entry) { - idx = got_packidx_get_object_idx(packidx, - &pid->id); - /* - * No need to traverse parents which are not in - * the pack file, are already in the desired - * set, or are marked for skipping already. - */ - if (idx == -1) - continue; - if (got_object_idset_contains(set, &pid->id)) - continue; - if (set != skip && - got_object_idset_contains(skip, &pid->id)) - continue; - - if (got_object_idset_contains(traversed, - &pid->id)) - continue; - err = queue_commit_id(&repaint, &pid->id, - color); - if (err) - goto done; - err = got_object_idset_add(traversed, - &pid->id, NULL); - if (err) - goto done; - } - } - got_object_commit_close(commit); - commit = NULL; - - pid = STAILQ_FIRST(&repaint); - if (pid == NULL) - break; - - err = paint_commit(pid, color); - if (err) - break; - - err = got_object_idset_add(set, &pid->id, NULL); - if (err) - break; - - STAILQ_REMOVE_HEAD(&repaint, entry); - - /* Insert or replace this commit on the painted list. */ - STAILQ_FOREACH(qid, painted, entry) { - if (got_object_id_cmp(&qid->id, &pid->id) != 0) - continue; - err = paint_commit(qid, color); - if (err) - goto done; - got_object_qid_free(pid); - pid = qid; - break; - } - if (qid == NULL) { - STAILQ_INSERT_TAIL(painted, pid, entry); - (*npainted)++; - } - - /* - * In case this commit is on the caller's list of - * pending commits to traverse, repaint it there. - */ - STAILQ_FOREACH(qid, ids, entry) { - if (got_object_id_cmp(&qid->id, &pid->id) != 0) - continue; - err = paint_commit(qid, color); - if (err) - goto done; - break; - } - - idx = got_packidx_get_object_idx(packidx, &pid->id); - if (idx == -1) { - /* - * Should not happen because we only queue - * parents which exist in our pack file. - */ - err = got_error(GOT_ERR_NO_OBJ); - break; - } - - err = open_commit(&commit, pack, packidx, idx, &pid->id, - objcache); - if (err) - break; - } -done: - if (commit) - got_object_commit_close(commit); - got_object_id_queue_free(&repaint); - got_object_idset_free(traversed); - - return err; -} - -static const struct got_error * paint_commits(struct got_object_id_queue *ids, int *nids, struct got_object_idset *keep, struct got_object_idset *drop, struct got_object_idset *skip, struct got_pack *pack, @@ -1881,12 +1746,6 @@ paint_commits(struct got_object_id_queue *ids, int *ni NULL); if (err) goto done; - err = repaint_parent_commits(&qid->id, idx, - COLOR_SKIP, skip, skip, ids, nids, - &painted, &npainted, pack, packidx, - objcache); - if (err) - goto done; break; } if (!got_object_idset_contains(keep, &qid->id)) { @@ -1903,12 +1762,6 @@ paint_commits(struct got_object_id_queue *ids, int *ni goto done; err = got_object_idset_add(skip, &qid->id, NULL); - if (err) - goto done; - err = repaint_parent_commits(&qid->id, idx, - COLOR_SKIP, skip, skip, ids, nids, - &painted, &npainted, pack, packidx, - objcache); if (err) goto done; break;