Commit Diff


commit - 05ea464b5805d35f00f67170d9cbf8bdede98178
commit + 5a19274d1f2108d99b338f96e8e397bc897be063
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 - fee8a73d38d4fafb28836c33a30c6167d61cdc30
blob + 64e555ba01c233deabfb7105c5e8a10004a56985
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -1046,87 +1046,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 - 1412c780886367fa09452ecbd5c3d48a59159abb
blob + d3c9cfdf809f293d9d737f4500fa006cfba5fee9
--- lib/pack_create_io.c
+++ lib/pack_create_io.c
@@ -279,10 +279,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
@@ -300,10 +296,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 - 25ea25814658bd73f9f241cb84ea7dedeed2da82
blob + d547d4144a625c2cc09903a16a50e9220708e9c7
--- lib/pack_create_privsep.c
+++ lib/pack_create_privsep.c
@@ -534,10 +534,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
@@ -555,10 +551,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 - 2b7517db1db1bed4e6a7897e9466b76d59b4017f
blob + ec345e5b6a00f849b5cfb2a76e633b05d6215588
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -1678,141 +1678,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,
@@ -1878,12 +1743,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)) {
@@ -1900,12 +1759,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;