summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b5c9f1c)
raw | patch | inline | side by side (parent: b5c9f1c)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 9 Feb 2012 21:30:52 +0000 (13:30 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 9 Feb 2012 21:30:52 +0000 (13:30 -0800) |
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 <gitster@pobox.com>
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 <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 b4fbc60e6d25157ed022ebd3f2bc8a2aeb774b0c..f385b8ac9e759f74b4711bdb93687202c1bc1600 100644 (file)
--- a/builtin/merge.c
+++ b/builtin/merge.c
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;
"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)"),
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);
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index a598dfa4777a8d459fd6e68b9a63c77d87e47c24..9e27bbf902e275671cb80310630a8bedcaab353c 100755 (executable)
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
test_cmp actual expect
'
+test_expect_success GPG 'merge --no-edit tag should skip editor' '
+ git reset --hard c0 &&
+ git commit --allow-empty -m "A newer commit" &&
+ git tag -f -s -m "A newer commit" signed &&
+ git reset --hard c0 &&
+
+ EDITOR=false git merge --no-edit signed &&
+ git rev-parse signed^0 >expect &&
+ git rev-parse HEAD^2 >actual &&
+ test_cmp actual expect
+'
+
test_done