Code

fast-import: don't allow 'ls' of path with empty components
[git.git] / t / t3200-branch.sh
index 859b99abf1cc62c966322fcfc552c0a7eb7356df..f308235f5dd28da2c19d91dc63803312aacd2cda 100755 (executable)
@@ -26,6 +26,17 @@ test_expect_success \
      ! test -f .git/refs/heads/--help
 '
 
+test_expect_success 'branch -h in broken repository' '
+       mkdir broken &&
+       (
+               cd broken &&
+               git init &&
+               >.git/refs/heads/master &&
+               test_expect_code 129 git branch -h >usage 2>&1
+       ) &&
+       grep "[Uu]sage" broken/usage
+'
+
 test_expect_success \
     'git branch abc should create a branch' \
     'git branch abc && test -f .git/refs/heads/abc'
@@ -228,24 +239,21 @@ test_expect_success 'checkout -b makes reflog by default' '
        git checkout master &&
        git config --unset core.logAllRefUpdates &&
        git checkout -b alpha &&
-       test -f .git/logs/refs/heads/alpha &&
-       PAGER= git reflog show alpha
+       git rev-parse --verify alpha@{0}
 '
 
 test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
        git checkout master &&
        git config core.logAllRefUpdates false &&
        git checkout -b beta &&
-       ! test -f .git/logs/refs/heads/beta &&
-       test_must_fail PAGER= git reflog show beta
+       test_must_fail git rev-parse --verify beta@{0}
 '
 
 test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
        git checkout master &&
        git checkout -lb gamma &&
        git config --unset core.logAllRefUpdates &&
-       test -f .git/logs/refs/heads/gamma &&
-       PAGER= git reflog show gamma
+       git rev-parse --verify gamma@{0}
 '
 
 test_expect_success 'avoid ambiguous track' '