summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-05-13 16:47:24 -0400
committerJunio C Hamano <gitster@pobox.com>2016-05-14 10:37:29 -0700
commit9874576995c8ecf800e48dead0e34c36defa91b4 (patch)
treebfcc6678dc921e73141f2b177480e9236aa7e0f1
parentf831acc6c6839426e6ccb42d7fd1931863bb07ac (diff)
downloadgit-9874576995c8ecf800e48dead0e34c36defa91b4.tar.gz
t9107: switch inverted single/double quotes in test
One of the test snippets in t9107 is enclosed in double quotes, but then uses single quotes to surround an interpolated variable inside the snippet, like: test_expect_success '...' " test -n '$head' " This happens to work because the variable is interpolated _before_ the snippet is run, and the result is eval'd. So as long as the variable does not contain any single quotes, the two are equivalent. And it doesn't, as we know it is a sha1 from rev-parse above. But this construct is unnecessarily confusing. But we can go a step further in cleaning up. The test is really checking that a particular ref has a value. Rather than checking if rev-parse produced output, we can just move rev-parse into the test itself, and rely on the exit code from --verify. Nobody else cares about the $head variable at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t9107-git-svn-migrate.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index b6a99b807f..9f3ef8f2ef 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -24,8 +24,9 @@ test_expect_success 'setup old-looking metadata' '
git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
'
-head=$(git rev-parse --verify refs/heads/git-svn-HEAD^0)
-test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"
+test_expect_success 'git-svn-HEAD is a real HEAD' '
+ git rev-parse --verify refs/heads/git-svn-HEAD^0
+'
svnrepo_escaped=$(echo $svnrepo | sed 's/ /%20/')