summaryrefslogtreecommitdiff
path: root/builtin/branch.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-10-22 06:42:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-10-22 18:02:59 (GMT)
commit1dacfbcf13693dad508095735a95bc4b12382c57 (patch)
tree6507bbf6dc64070b46392c94019ee1a42684af14 /builtin/branch.c
parent00648ba0505bbe1999bb6ae2f1d02a0ef923b191 (diff)
downloadgit-1dacfbcf13693dad508095735a95bc4b12382c57.zip
git-1dacfbcf13693dad508095735a95bc4b12382c57.tar.gz
git-1dacfbcf13693dad508095735a95bc4b12382c57.tar.bz2
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 'builtin/branch.c')
-rw-r--r--builtin/branch.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index 87976f0..0e50556 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -667,6 +667,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
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)