Print message during "git merge" and "git status". Add a new "mergeHints" advice to silence these messages. Signed-off-by: Andrew Wong <andrew.kw.w@xxxxxxxxx> --- Documentation/config.txt | 3 +++ advice.c | 2 ++ advice.h | 1 + builtin/merge.c | 6 ++++++ wt-status.c | 3 +++ 5 files changed, 15 insertions(+) diff --git a/Documentation/config.txt b/Documentation/config.txt index 73904bc..936a20b 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -196,6 +196,9 @@ advice.*:: rmHints:: In case of failure in the output of linkgit:git-rm[1], show directions on how to proceed from the current state. + mergeHints:: + Show directions on how to proceed from the current state in the + output of linkgit:git-merge[1]. -- core.fileMode:: diff --git a/advice.c b/advice.c index 486f823..e910734 100644 --- a/advice.c +++ b/advice.c @@ -15,6 +15,7 @@ int advice_detached_head = 1; int advice_set_upstream_failure = 1; int advice_object_name_warning = 1; int advice_rm_hints = 1; +int advice_merge_hints = 1; static struct { const char *name; @@ -35,6 +36,7 @@ static struct { { "setupstreamfailure", &advice_set_upstream_failure }, { "objectnamewarning", &advice_object_name_warning }, { "rmhints", &advice_rm_hints }, + { "mergehints", &advice_merge_hints }, /* make this an alias for backward compatibility */ { "pushnonfastforward", &advice_push_update_rejected } diff --git a/advice.h b/advice.h index 5ecc6c1..d337f1c 100644 --- a/advice.h +++ b/advice.h @@ -18,6 +18,7 @@ extern int advice_detached_head; extern int advice_set_upstream_failure; extern int advice_object_name_warning; extern int advice_rm_hints; +extern int advice_merge_hints; int git_default_advice_config(const char *var, const char *value); __attribute__((format (printf, 1, 2))) diff --git a/builtin/merge.c b/builtin/merge.c index f0cf120..c55ac03 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -805,6 +805,8 @@ static void abort_commit(struct commit_list *remoteheads, const char *err_msg) error("%s", err_msg); fprintf(stderr, _("Not committing merge; use 'git commit' to complete the merge.\n")); + if (advice_merge_hints) + printf(_(" (use \"git merge --abort\" to abort the merge)\n")); write_merge_state(remoteheads); exit(1); } @@ -913,6 +915,8 @@ static int suggest_conflicts(int renormalizing) rerere(allow_rerere_auto); printf(_("Automatic merge failed; " "fix conflicts and then commit the result.\n")); + if (advice_merge_hints) + printf(_(" (use \"git merge --abort\" to abort the merge)\n")); return 1; } @@ -1559,6 +1563,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix) if (merge_was_ok) fprintf(stderr, _("Automatic merge went well; " "stopped before committing as requested\n")); + if (advice_merge_hints) + printf(_(" (use \"git merge --abort\" to abort the merge)\n")); else ret = suggest_conflicts(option_renormalize); diff --git a/wt-status.c b/wt-status.c index 9f2358a..3b30bf9 100644 --- a/wt-status.c +++ b/wt-status.c @@ -907,6 +907,9 @@ static void show_merge_in_progress(struct wt_status *s, status_printf_ln(s, color, _(" (use \"git commit\" to conclude the merge)")); } + if (s->hints) + status_printf_ln(s, color, + _(" (use \"git merge --abort\" to abort the merge)")); wt_status_print_trailer(s); } -- 1.9.0.174.g6f75b8f -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html