summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Wong <andrew.kw.w@gmail.com>2014-03-14 00:37:51 -0400
committerJunio C Hamano <gitster@pobox.com>2014-03-17 14:54:16 -0700
commitbd28eaf2977a5ae9aab85c7dda07d4e2476ae3c0 (patch)
tree31bae6b59c5e8471d5cfcadc8957ea2c5d09d5f5
parent1c43d1ab88d18eb13e12215552dceb26e18500b7 (diff)
downloadgit-aw/merge-help-messages.tar.gz
merge: advise user to use "git merge --abort" to abort mergesaw/merge-help-messages
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@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--Documentation/config.txt3
-rw-r--r--advice.c2
-rw-r--r--advice.h1
-rw-r--r--builtin/merge.c6
-rw-r--r--wt-status.c3
5 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5f4d7939ed..db5869a1bc 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -202,6 +202,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 3eca9f5ffd..bfbb6b68fb 100644
--- a/advice.c
+++ b/advice.c
@@ -16,6 +16,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;
@@ -37,6 +38,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 08fbc8ee3c..839b75222f 100644
--- a/advice.h
+++ b/advice.h
@@ -19,6 +19,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 e576a7fdc6..8e8e1362a0 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -802,6 +802,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);
}
@@ -910,6 +912,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;
}
@@ -1556,6 +1560,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 4f9c76ab8e..d6cfef2d81 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);
}