summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 00648ba)
raw | patch | inline | side by side (parent: 00648ba)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Fri, 22 Oct 2010 06:42:58 +0000 (01:42 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 22 Oct 2010 18:02:59 +0000 (11:02 -0700) |
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>
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>
builtin/branch.c | patch | blob | history | |
t/t3200-branch.sh | patch | blob | history |
diff --git a/builtin/branch.c b/builtin/branch.c
index 87976f0921d87f2a8564eb54aa3b81d30ee7f214..0e50556a151c186429e13d03fc8e279fa6ddecd5 100644 (file)
--- a/builtin/branch.c
+++ b/builtin/branch.c
OPT_END(),
};
+ if (argc == 2 && !strcmp(argv[1], "-h"))
+ usage_with_options(builtin_branch_usage, options);
+
git_config(git_branch_config, NULL);
if (branch_use_color == -1)
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index f54a533456d74a3eb2f745dbc77c8ad5a5ae960f..f308235f5dd28da2c19d91dc63803312aacd2cda 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
! 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'