summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cbb3167)
raw | patch | inline | side by side (parent: cbb3167)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Fri, 22 Oct 2010 06:49:45 +0000 (01:49 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 22 Oct 2010 18:04:53 +0000 (11:04 -0700) |
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>
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>
builtin/merge.c | patch | blob | history | |
t/t7600-merge.sh | patch | blob | history |
diff --git a/builtin/merge.c b/builtin/merge.c
index 5f65c0c8a6eacd4c6d05602ad9de2821ec62a034..584c94f6fbc6bc474ac2b2bf35f0048ea58943e4 100644 (file)
--- a/builtin/merge.c
+++ b/builtin/merge.c
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");
}
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index b4f40e4c3a53388e72347e8e3894edd05f17dab5..b147a1bd69e96e48d3808028a3775a609471639a 100755 (executable)
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
test_must_fail git merge
'
+test_expect_success 'merge -h with invalid index' '
+ mkdir broken &&
+ (
+ cd broken &&
+ git init &&
+ >.git/index &&
+ test_expect_code 129 git merge -h 2>usage
+ ) &&
+ grep "[Uu]sage: git merge" broken/usage
+'
+
test_expect_success 'reject non-strategy with a git-merge-foo name' '
test_must_fail git merge -s index c1
'