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@.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
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