commit 9f6b5e1c564c7dfaf6868179cea3515d730bf3d5 from: Stefan Sperling via: Thomas Adam date: Sat Aug 06 20:57:41 2022 UTC tweak tag_test_create to detect the issue fixed in previous commit commit - 021334f93ef590f85da3fa9312fcc519eb6b2d25 commit + 9f6b5e1c564c7dfaf6868179cea3515d730bf3d5 blob - d7bf186e4decab4cc4922f2dd6d76908101102bf blob + b0593d23ccabf692437ea2a4e5550470e381b567 --- regress/cmdline/tag.sh +++ regress/cmdline/tag.sh @@ -61,6 +61,10 @@ test_tag_create() { fi # Create a tag based on implied worktree HEAD ref + (cd $testroot/wt && got branch foo > /dev/null) + echo 'foo' >> $testroot/wt/alpha + (cd $testroot/wt && got commit -m foo > /dev/null) + local commit_id2=`git_show_branch_head $testroot/repo foo` (cd $testroot/wt && got tag -m 'test' $tag2 > $testroot/stdout) ret=$? if [ $ret -ne 0 ]; then @@ -79,6 +83,14 @@ test_tag_create() { return 1 fi + tagged_commit=`got cat -r $testroot/repo $tag2 | grep ^object \ + | cut -d' ' -f2` + if [ "$tagged_commit" != "$commit_id2" ]; then + echo "wrong commit was tagged" >&2 + test_done "$testroot" "1" + return 1 + fi + (cd $testroot/repo && git checkout -q $tag2) ret=$? if [ $ret -ne 0 ]; then @@ -93,7 +105,7 @@ test_tag_create() { 2> $testroot/stderr) ret=$? if [ $ret -eq 0 ]; then - echo "git tag command succeeded unexpectedly" + echo "got tag command succeeded unexpectedly" test_done "$testroot" "1" return 1 fi @@ -109,10 +121,11 @@ test_tag_create() { fi got ref -r $testroot/repo -l > $testroot/stdout - echo "HEAD: $commit_id" > $testroot/stdout.expected + echo "HEAD: $commit_id2" > $testroot/stdout.expected echo -n "refs/got/worktree/base-" >> $testroot/stdout.expected cat $testroot/wt/.got/uuid | tr -d '\n' >> $testroot/stdout.expected - echo ": $commit_id" >> $testroot/stdout.expected + echo ": $commit_id2" >> $testroot/stdout.expected + echo "refs/heads/foo: $commit_id2" >> $testroot/stdout.expected echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected echo "refs/tags/$tag: $tag_id" >> $testroot/stdout.expected echo "refs/tags/$tag2: $tag_id2" >> $testroot/stdout.expected