Commit 03c03172348b5f515b9ce884313118428a8674b5

Stefan Sperling 2022-04-10T12:08:45

in findtwixt(), drop a commit right away if it matches an excluded commit

diff --git a/lib/pack_create.c b/lib/pack_create.c
index f72e0ae..8a2f38c 100644
--- a/lib/pack_create.c
+++ b/lib/pack_create.c
@@ -1267,9 +1267,20 @@ findtwixt(struct got_object_id ***res, int *nres, int *ncolored,
 
 	for (i = 0; i < nhead; i++) {
 		struct got_object_id *id = head[i];
+		int j, color = COLOR_KEEP;
+
 		if (id == NULL)
 			continue;
-		err = queue_commit_or_tag_id(id, COLOR_KEEP, &ids, repo);
+
+		for (j = 0; j < ntail; j++) {
+			if (tail[j] != NULL &&
+			    got_object_id_cmp(id, tail[j]) == 0) {
+				color = COLOR_DROP;
+				break;
+			}
+		}
+
+		err = queue_commit_or_tag_id(id, color, &ids, repo);
 		if (err)
 			goto done;
 	}