From 3adab6f3a7793253b22a4a7aae34221d19e0236a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 9 Feb 2012 13:30:52 -0800 Subject: merge: do not launch an editor on "--no-edit $tag" When the user explicitly asked us not to, don't launch an editor. But do everything else the same way as the "edit" case, i.e. leave the comment with verification result in the log template and record the mergesig in the resulting merge commit for later inspection. Based on initiail analysis by Jonathan Nieder. Signed-off-by: Junio C Hamano --- builtin/merge.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'builtin') diff --git a/builtin/merge.c b/builtin/merge.c index b4fbc60e6..f385b8ac9 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -48,7 +48,7 @@ static const char * const builtin_merge_usage[] = { static int show_diffstat = 1, shortlog_len = -1, squash; static int option_commit = 1, allow_fast_forward = 1; -static int fast_forward_only, option_edit; +static int fast_forward_only, option_edit = -1; static int allow_trivial = 1, have_message; static int overwrite_ignore = 1; static struct strbuf merge_msg = STRBUF_INIT; @@ -193,7 +193,7 @@ static struct option builtin_merge_options[] = { "create a single commit instead of doing a merge"), OPT_BOOLEAN(0, "commit", &option_commit, "perform a commit if the merge succeeds (default)"), - OPT_BOOLEAN('e', "edit", &option_edit, + OPT_BOOL('e', "edit", &option_edit, "edit message before committing"), OPT_BOOLEAN(0, "ff", &allow_fast_forward, "allow fast-forward (default)"), @@ -1287,11 +1287,15 @@ int cmd_merge(int argc, const char **argv, const char *prefix) merge_remote_util(commit) && merge_remote_util(commit)->obj && merge_remote_util(commit)->obj->type == OBJ_TAG) { - option_edit = 1; + if (option_edit < 0) + option_edit = 1; allow_fast_forward = 0; } } + if (option_edit < 0) + option_edit = 0; + if (!use_strategies) { if (!remoteheads->next) add_strategies(pull_twohead, DEFAULT_TWOHEAD); -- cgit v1.2.1