summaryrefslogtreecommitdiff
path: root/t/t3200-branch.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-10-22 01:42:58 -0500
committerJunio C Hamano <gitster@pobox.com>2010-10-22 11:02:59 -0700
commit1dacfbcf13693dad508095735a95bc4b12382c57 (patch)
tree6507bbf6dc64070b46392c94019ee1a42684af14 /t/t3200-branch.sh
parent00648ba0505bbe1999bb6ae2f1d02a0ef923b191 (diff)
downloadgit-1dacfbcf13693dad508095735a95bc4b12382c57.tar.gz
branch -h: show usage even in an invalid repository
There is no need for "git branch -h" to try to access a repository. In the spirit of v1.6.6-rc0~34^2~3 (Let 'git <command> -h' show usage without a git dir, 2009-11-09). This brings git one step closer to passing the following (automatically verifiable) test: Before any repository access (aside from git_config()), a function from the setup_git_directory_* family has been run and thus one step closer to being able to use an automatic repository access checker. [jn: simplified; new commit message, test] Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-xt/t3200-branch.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index f54a533456..f308235f5d 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -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'