summaryrefslogtreecommitdiff
path: root/builtin/gc.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-10-22 06:47:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-10-22 18:04:53 (GMT)
commit0c8151b6ff5b79e6638e4f8339d62b051998dc2f (patch)
treecccf62beaed093cfc43a601b9d8f1de6fb10d0ae /builtin/gc.c
parent5d3dd915e64ea42ba6bf7646937784f6ddc71422 (diff)
downloadgit-0c8151b6ff5b79e6638e4f8339d62b051998dc2f.zip
git-0c8151b6ff5b79e6638e4f8339d62b051998dc2f.tar.gz
git-0c8151b6ff5b79e6638e4f8339d62b051998dc2f.tar.bz2
gc -h: show usage even with broken configuration
Given a request for command-line usage information rather than some more substantial action, the only friendly thing to do is to report the usage information as soon as possible and exit. Without this change, as "git gc" glances over the repository, it can be distracted by the desire to report a malformed configuration file. Noticed while working through reports from Duy's repository access checker. [jn: with rewritten log message and tests] 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/gc.c')
-rw-r--r--builtin/gc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index c304638..93deed5 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -189,6 +189,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
OPT_END()
};
+ if (argc == 2 && !strcmp(argv[1], "-h"))
+ usage_with_options(builtin_gc_usage, builtin_gc_options);
+
git_config(gc_config, NULL);
if (pack_refs < 0)