summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorLibravatar Vincent van Ravesteijn <vfr@lyx.org>2011-11-21 14:30:40 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-11-21 09:29:06 -0800
commit5480207c4ee395fbb82682bc2065c93a43e24328 (patch)
treee207d6959d00b6caf08960f466f2f5a228f39ec9 /builtin/merge.c
parentGit 1.7.7.4 (diff)
downloadtgif-5480207c4ee395fbb82682bc2065c93a43e24328.tar.xz
Show error for 'git merge' with unset merge.defaultToUpstream
'git merge' can be called without any arguments if merge.defaultToUpstream is set. However, when merge.defaultToUpstream is not set, the user will be presented the usage information as if he entered a command with a wrong syntaxis. Ironically, the usage information confirms that no arguments are mandatory. This adds a proper error message telling the user why the command failed. As a side-effect this can help the user in discovering the possibility to merge with the upstream branch by setting merge.defaultToUpstream. Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 581f494aee..c44251c1fd 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1094,9 +1094,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
die(_("You cannot combine --no-ff with --ff-only."));
if (!abort_current_merge) {
- if (!argc && default_to_upstream)
- argc = setup_with_upstream(&argv);
- else if (argc == 1 && !strcmp(argv[0], "-"))
+ if (!argc) {
+ if (default_to_upstream)
+ argc = setup_with_upstream(&argv);
+ else
+ die(_("No commit specified and merge.defaultToUpstream not set."));
+ } else if (argc == 1 && !strcmp(argv[0], "-"))
argv[0] = "@{-1}";
}
if (!argc)