Merge branch 'jn/merge-no-edit-fix' into maint
* jn/merge-no-edit-fix: merge: do not launch an editor on "--no-edit $tag"maint
commit
42e283a1bf
|
|
@ -48,7 +48,7 @@ static const char * const builtin_merge_usage[] = {
|
||||||
|
|
||||||
static int show_diffstat = 1, shortlog_len = -1, squash;
|
static int show_diffstat = 1, shortlog_len = -1, squash;
|
||||||
static int option_commit = 1, allow_fast_forward = 1;
|
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 allow_trivial = 1, have_message;
|
||||||
static int overwrite_ignore = 1;
|
static int overwrite_ignore = 1;
|
||||||
static struct strbuf merge_msg = STRBUF_INIT;
|
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"),
|
"create a single commit instead of doing a merge"),
|
||||||
OPT_BOOLEAN(0, "commit", &option_commit,
|
OPT_BOOLEAN(0, "commit", &option_commit,
|
||||||
"perform a commit if the merge succeeds (default)"),
|
"perform a commit if the merge succeeds (default)"),
|
||||||
OPT_BOOLEAN('e', "edit", &option_edit,
|
OPT_BOOL('e', "edit", &option_edit,
|
||||||
"edit message before committing"),
|
"edit message before committing"),
|
||||||
OPT_BOOLEAN(0, "ff", &allow_fast_forward,
|
OPT_BOOLEAN(0, "ff", &allow_fast_forward,
|
||||||
"allow fast-forward (default)"),
|
"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) &&
|
||||||
merge_remote_util(commit)->obj &&
|
merge_remote_util(commit)->obj &&
|
||||||
merge_remote_util(commit)->obj->type == OBJ_TAG) {
|
merge_remote_util(commit)->obj->type == OBJ_TAG) {
|
||||||
|
if (option_edit < 0)
|
||||||
option_edit = 1;
|
option_edit = 1;
|
||||||
allow_fast_forward = 0;
|
allow_fast_forward = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (option_edit < 0)
|
||||||
|
option_edit = 0;
|
||||||
|
|
||||||
if (!use_strategies) {
|
if (!use_strategies) {
|
||||||
if (!remoteheads->next)
|
if (!remoteheads->next)
|
||||||
add_strategies(pull_twohead, DEFAULT_TWOHEAD);
|
add_strategies(pull_twohead, DEFAULT_TWOHEAD);
|
||||||
|
|
|
||||||
|
|
@ -683,4 +683,16 @@ test_expect_success GPG 'merge --ff-only tag' '
|
||||||
test_cmp actual expect
|
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
|
test_done
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue