commit - 78817826917980c893186ca523093b97061f40d5
commit + 49a2d94a5f7df3001e60ade1362ad31c2895a496
blob - 6a9b885f50fdef235552e06736cf2cf4c40086d4
blob + 0924766f7f872d5e0069fff10df5a98992653948
--- regress/cmdline/tag.sh
+++ regress/cmdline/tag.sh
ret=$?
if [ $ret -ne 0 ]; then
echo "got checkout command failed unexpectedly"
- test_done "$testroot" "$ret"
- return 1
- fi
-
- # Create a tag based on implied worktree HEAD ref
- (cd $testroot/wt && got tag -m 'test' $tag2 > $testroot/stdout)
- ret=$?
- if [ $ret -ne 0 ]; then
- test_done "$testroot" "$ret"
- return 1
- fi
-
- tag_id2=`got ref -r $testroot/repo -l \
- | grep "^refs/tags/$tag2" | tr -d ' ' | cut -d: -f2`
- echo "Created tag $tag_id2" > $testroot/stdout.expected
- cmp -s $testroot/stdout $testroot/stdout.expected
- ret=$?
- if [ $ret -ne 0 ]; then
- diff -u $testroot/stdout.expected $testroot/stdout
- test_done "$testroot" "$ret"
- return 1
- fi
-
- (cd $testroot/repo && git checkout -q $tag2)
- ret=$?
- if [ $ret -ne 0 ]; then
- echo "git checkout command failed unexpectedly"
- test_done "$testroot" "$ret"
- return 1
- fi
-
- # Attempt to create a tag pointing at a non-commit
- local tree_id=`git_show_tree $testroot/repo`
- (cd $testroot/wt && got tag -m 'test' -c $tree_id foobar \
- 2> $testroot/stderr)
- ret=$?
- if [ $ret -eq 0 ]; then
- echo "git tag command succeeded unexpectedly"
- test_done "$testroot" "1"
- return 1
fi
-
- echo "got: commit $tree_id: object not found" \
- > $testroot/stderr.expected
- cmp -s $testroot/stderr $testroot/stderr.expected
- ret=$?
- if [ $ret -ne 0 ]; then
- diff -u $testroot/stderr.expected $testroot/stderr
- test_done "$testroot" "$ret"
- return 1
- fi
-
- got ref -r $testroot/repo -l > $testroot/stdout
- echo "HEAD: $commit_id" > $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 "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
- cmp -s $testroot/stdout $testroot/stdout.expected
- ret=$?
- if [ $ret -ne 0 ]; then
- diff -u $testroot/stdout.expected $testroot/stdout
- fi
test_done "$testroot" "$ret"
}