merge -h: show usage even with corrupt index
Part of a campaign to make sure "git <command> -h" works correctly
when run from distractingly bad repositories.
[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>
diff --git a/builtin/merge.c b/builtin/merge.c
index 5f65c0c..584c94f 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -909,6 +909,8 @@
const char *best_strategy = NULL, *wt_strategy = NULL;
struct commit_list **remotes = &remoteheads;
+ if (argc == 2 && !strcmp(argv[1], "-h"))
+ usage_with_options(builtin_merge_usage, builtin_merge_options);
if (read_cache_unmerged()) {
die_resolve_conflict("merge");
}