commit 2d463f36e73eea85e832bdaff7005634fbdc94e7 from: Stefan Sperling date: Mon Aug 12 22:42:47 2019 UTC test behaviour when 'got ref -s' is given a non-reference target commit - d1c1ae5fa698c48d70eb16cef11bb3710221ea88 commit + 2d463f36e73eea85e832bdaff7005634fbdc94e7 blob - 3774051198b40f4ceaef773bcd650eaba78d8ead blob + 879c3950c6ab68af42c59df399f05fd5eb5d8756 --- regress/cmdline/ref.sh +++ regress/cmdline/ref.sh @@ -75,8 +75,28 @@ function test_ref_create { if [ "$ret" != "0" ]; then echo "git checkout command failed unexpectedly" test_done "$testroot" "$ret" + return 1 fi + # Attempt to create a symbolic ref pointing at a non-reference + (cd $testroot/wt && got ref -s refs/heads/symbolicref $commit_id \ + 2> $testroot/stderr) + ret="$?" + if [ "$ret" == "0" ]; then + echo "git ref command succeeded unexpectedly" + test_done "$testroot" "1" + return 1 + fi + + echo "got: reference $commit_id not found" > $testroot/stderr.expected + cmp -s $testroot/stderr $testroot/stderr.expected + ret="$?" + if [ "$ret" != "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: refs/heads/symbolicref" > $testroot/stdout.expected echo -n "refs/got/worktree/base-" >> $testroot/stdout.expected