From cf9d52e4899219523359ad1542605395c8c86337 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Fri, 22 Oct 2010 01:44:01 -0500 Subject: checkout-index -h: show usage even in an invalid repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit checkout-index loads the index before parsing options. Erroring out is counterproductive at that point if the operator is hunting for a command to recover useful data from the broken repository. [jn: new commit message, tests] Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- builtin/checkout-index.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'builtin/checkout-index.c') diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index a7a5ee10f3..3bf342232b 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -241,6 +241,9 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) OPT_END() }; + if (argc == 2 && !strcmp(argv[1], "-h")) + usage_with_options(builtin_checkout_index_usage, + builtin_checkout_index_options); git_config(git_default_config, NULL); state.base_dir = ""; prefix_length = prefix ? strlen(prefix) : 0; -- cgit v1.2.3