Commit ce2bf7b7c9058374563c6db8608dbab9df2bba7d

Stefan Sperling 2022-05-29T17:51:33

fix a bug in findwixt() which caused pack files with missing parent commits The 'nskip' variable is supposed to reflect commits which are waiting on the queue and have the 'skip' color. Only increment 'nskip' when adding such commits to the queue. Problem observed with got send -T and a tag pointing to a deleted branch. Test to reproduce the bug written by op@.

diff --git a/lib/pack_create.c b/lib/pack_create.c
index bb8a404..16709d2 100644
--- a/lib/pack_create.c
+++ b/lib/pack_create.c
@@ -1292,7 +1292,6 @@ paint_commits(int *ncolored, struct got_object_id_queue *ids, int nids,
 				err = paint_commit(qid, COLOR_SKIP);
 				if (err)
 					goto done;
-				nskip++;
 			} else
 				(*ncolored)++;
 			err = got_object_idset_add(keep, &qid->id, NULL);
@@ -1308,7 +1307,6 @@ paint_commits(int *ncolored, struct got_object_id_queue *ids, int nids,
 				err = paint_commit(qid, COLOR_SKIP);
 				if (err)
 					goto done;
-				nskip++;
 			} else
 				(*ncolored)++;
 			err = got_object_idset_add(drop, &qid->id, NULL);
diff --git a/regress/cmdline/send.sh b/regress/cmdline/send.sh
index f96b6f0..1b07381 100755
--- a/regress/cmdline/send.sh
+++ b/regress/cmdline/send.sh
@@ -845,11 +845,17 @@ remote "origin" {
 EOF
 	got branch -r $testroot/repo foo
 
-	# modify alpha on branch foo
+	# modify beta on branch foo
 	got checkout -b foo $testroot/repo $testroot/wt > /dev/null
 	echo boo >> $testroot/wt/beta
 	(cd $testroot/wt && got commit -m 'changed beta on branch foo' \
 		> /dev/null)
+	echo buu >> $testroot/wt/beta
+	(cd $testroot/wt && got commit -m 'changed beta again on branch foo' \
+		> /dev/null)
+	echo baa >> $testroot/wt/beta
+	(cd $testroot/wt && got commit -m 'changed beta again on branch foo' \
+		> /dev/null)
 	local commit_id2=`git_show_branch_head $testroot/repo foo`
 
 	# tag HEAD commit of branch foo