diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-12-27 00:11:41 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-27 00:11:41 -0800 |
commit | 05f6e1be8cdae1ebedf3cf7b7a072a3b35f945b5 (patch) | |
tree | 1312b104cc48f5c06c74fbf5d03ffa95e5a3f618 /builtin | |
parent | 1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac (diff) | |
parent | c7d227df5bf7fe9d5df98a55cd637bfaf38685ea (diff) | |
download | git-05f6e1be8cdae1ebedf3cf7b7a072a3b35f945b5.tar.gz git-05f6e1be8cdae1ebedf3cf7b7a072a3b35f945b5.tar.xz |
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'
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/merge.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/builtin/merge.c b/builtin/merge.c index 0070bf255..a96d4fb50 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -46,6 +46,7 @@ static const char * const builtin_merge_usage[] = { N_("git merge [<options>] [<commit>...]"), N_("git merge [<options>] <msg> HEAD <commit>"), N_("git merge --abort"), + N_("git merge --continue"), NULL }; @@ -65,6 +66,7 @@ static int option_renormalize; static int verbosity; static int allow_rerere_auto; static int abort_current_merge; +static int continue_current_merge; static int allow_unrelated_histories; static int show_progress = -1; static int default_to_upstream = 1; @@ -223,6 +225,8 @@ static struct option builtin_merge_options[] = { OPT__VERBOSITY(&verbosity), OPT_BOOL(0, "abort", &abort_current_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, N_("allow merging unrelated histories")), 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; struct commit_list *remoteheads, *p; void *branch_to_free; + int orig_argc = argc; if (argc == 2 && !strcmp(argv[1], "-h")) 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; 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())) 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; } + 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()) die_resolve_conflict("merge"); |