Merge branch 'cp/merge-continue'
"git merge --continue" has been added as a synonym to "git commit" to conclude a merge that has stopped due to conflicts. * cp/merge-continue: merge: mark usage error strings for translation merge: ensure '--abort' option takes no arguments completion: add --continue option for merge merge: add '--continue' option as a synonym for 'git commit'
This commit is contained in:
commit
05f6e1be8c
@ -15,6 +15,7 @@ SYNOPSIS
|
|||||||
[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
|
[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
|
||||||
'git merge' <msg> HEAD <commit>...
|
'git merge' <msg> HEAD <commit>...
|
||||||
'git merge' --abort
|
'git merge' --abort
|
||||||
|
'git merge' --continue
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
@ -61,6 +62,8 @@ reconstruct the original (pre-merge) changes. Therefore:
|
|||||||
discouraged: while possible, it may leave you in a state that is hard to
|
discouraged: while possible, it may leave you in a state that is hard to
|
||||||
back out of in the case of a conflict.
|
back out of in the case of a conflict.
|
||||||
|
|
||||||
|
The fourth syntax ("`git merge --continue`") can only be run after the
|
||||||
|
merge has resulted in conflicts.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
@ -99,6 +102,11 @@ commit or stash your changes before running 'git merge'.
|
|||||||
'git merge --abort' is equivalent to 'git reset --merge' when
|
'git merge --abort' is equivalent to 'git reset --merge' when
|
||||||
`MERGE_HEAD` is present.
|
`MERGE_HEAD` is present.
|
||||||
|
|
||||||
|
--continue::
|
||||||
|
After a 'git merge' stops due to conflicts you can conclude the
|
||||||
|
merge by running 'git merge --continue' (see "HOW TO RESOLVE
|
||||||
|
CONFLICTS" section below).
|
||||||
|
|
||||||
<commit>...::
|
<commit>...::
|
||||||
Commits, usually other branch heads, to merge into our branch.
|
Commits, usually other branch heads, to merge into our branch.
|
||||||
Specifying more than one commit will create a merge with
|
Specifying more than one commit will create a merge with
|
||||||
|
@ -46,6 +46,7 @@ static const char * const builtin_merge_usage[] = {
|
|||||||
N_("git merge [<options>] [<commit>...]"),
|
N_("git merge [<options>] [<commit>...]"),
|
||||||
N_("git merge [<options>] <msg> HEAD <commit>"),
|
N_("git merge [<options>] <msg> HEAD <commit>"),
|
||||||
N_("git merge --abort"),
|
N_("git merge --abort"),
|
||||||
|
N_("git merge --continue"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ static int option_renormalize;
|
|||||||
static int verbosity;
|
static int verbosity;
|
||||||
static int allow_rerere_auto;
|
static int allow_rerere_auto;
|
||||||
static int abort_current_merge;
|
static int abort_current_merge;
|
||||||
|
static int continue_current_merge;
|
||||||
static int allow_unrelated_histories;
|
static int allow_unrelated_histories;
|
||||||
static int show_progress = -1;
|
static int show_progress = -1;
|
||||||
static int default_to_upstream = 1;
|
static int default_to_upstream = 1;
|
||||||
@ -223,6 +225,8 @@ static struct option builtin_merge_options[] = {
|
|||||||
OPT__VERBOSITY(&verbosity),
|
OPT__VERBOSITY(&verbosity),
|
||||||
OPT_BOOL(0, "abort", &abort_current_merge,
|
OPT_BOOL(0, "abort", &abort_current_merge,
|
||||||
N_("abort the current in-progress merge")),
|
N_("abort the current in-progress merge")),
|
||||||
|
OPT_BOOL(0, "continue", &continue_current_merge,
|
||||||
|
N_("continue the current in-progress merge")),
|
||||||
OPT_BOOL(0, "allow-unrelated-histories", &allow_unrelated_histories,
|
OPT_BOOL(0, "allow-unrelated-histories", &allow_unrelated_histories,
|
||||||
N_("allow merging unrelated histories")),
|
N_("allow merging unrelated histories")),
|
||||||
OPT_SET_INT(0, "progress", &show_progress, N_("force progress reporting"), 1),
|
OPT_SET_INT(0, "progress", &show_progress, N_("force progress reporting"), 1),
|
||||||
@ -1125,6 +1129,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
const char *best_strategy = NULL, *wt_strategy = NULL;
|
const char *best_strategy = NULL, *wt_strategy = NULL;
|
||||||
struct commit_list *remoteheads, *p;
|
struct commit_list *remoteheads, *p;
|
||||||
void *branch_to_free;
|
void *branch_to_free;
|
||||||
|
int orig_argc = argc;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||||
usage_with_options(builtin_merge_usage, builtin_merge_options);
|
usage_with_options(builtin_merge_usage, builtin_merge_options);
|
||||||
@ -1158,6 +1163,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
int nargc = 2;
|
int nargc = 2;
|
||||||
const char *nargv[] = {"reset", "--merge", NULL};
|
const char *nargv[] = {"reset", "--merge", NULL};
|
||||||
|
|
||||||
|
if (orig_argc != 2)
|
||||||
|
usage_msg_opt(_("--abort expects no arguments"),
|
||||||
|
builtin_merge_usage, builtin_merge_options);
|
||||||
|
|
||||||
if (!file_exists(git_path_merge_head()))
|
if (!file_exists(git_path_merge_head()))
|
||||||
die(_("There is no merge to abort (MERGE_HEAD missing)."));
|
die(_("There is no merge to abort (MERGE_HEAD missing)."));
|
||||||
|
|
||||||
@ -1166,6 +1175,22 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (continue_current_merge) {
|
||||||
|
int nargc = 1;
|
||||||
|
const char *nargv[] = {"commit", NULL};
|
||||||
|
|
||||||
|
if (orig_argc != 2)
|
||||||
|
usage_msg_opt(_("--continue expects no arguments"),
|
||||||
|
builtin_merge_usage, builtin_merge_options);
|
||||||
|
|
||||||
|
if (!file_exists(git_path_merge_head()))
|
||||||
|
die(_("There is no merge in progress (MERGE_HEAD missing)."));
|
||||||
|
|
||||||
|
/* Invoke 'git commit' */
|
||||||
|
ret = cmd_commit(nargc, nargv, prefix);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
if (read_cache_unmerged())
|
if (read_cache_unmerged())
|
||||||
die_resolve_conflict("merge");
|
die_resolve_conflict("merge");
|
||||||
|
|
||||||
|
@ -1552,7 +1552,7 @@ _git_merge ()
|
|||||||
case "$cur" in
|
case "$cur" in
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "$__git_merge_options
|
__gitcomp "$__git_merge_options
|
||||||
--rerere-autoupdate --no-rerere-autoupdate --abort"
|
--rerere-autoupdate --no-rerere-autoupdate --abort --continue"
|
||||||
return
|
return
|
||||||
esac
|
esac
|
||||||
__gitcomp_nl "$(__git_refs)"
|
__gitcomp_nl "$(__git_refs)"
|
||||||
|
@ -154,6 +154,10 @@ test_expect_success 'test option parsing' '
|
|||||||
test_must_fail git merge -s foobar c1 &&
|
test_must_fail git merge -s foobar c1 &&
|
||||||
test_must_fail git merge -s=foobar c1 &&
|
test_must_fail git merge -s=foobar c1 &&
|
||||||
test_must_fail git merge -m &&
|
test_must_fail git merge -m &&
|
||||||
|
test_must_fail git merge --abort foobar &&
|
||||||
|
test_must_fail git merge --abort --quiet &&
|
||||||
|
test_must_fail git merge --continue foobar &&
|
||||||
|
test_must_fail git merge --continue --quiet &&
|
||||||
test_must_fail git merge
|
test_must_fail git merge
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -763,4 +767,11 @@ test_expect_success 'merge nothing into void' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'merge can be completed with --continue' '
|
||||||
|
git reset --hard c0 &&
|
||||||
|
git merge --no-ff --no-commit c1 &&
|
||||||
|
git merge --continue &&
|
||||||
|
verify_parents $c0 $c1
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user