git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Wong <andrew.kw.w@gmail.com>
To: git@vger.kernel.org
Cc: Andrew Wong <andrew.kw.w@gmail.com>
Subject: [PATCH 2/3] merge: Advise user to use "git merge --abort" to abort merges
Date: Fri, 14 Mar 2014 00:37:51 -0400	[thread overview]
Message-ID: <1394771872-25940-3-git-send-email-andrew.kw.w@gmail.com> (raw)
In-Reply-To: <1394771872-25940-1-git-send-email-andrew.kw.w@gmail.com>

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>
---
 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

  parent reply	other threads:[~2014-03-14  4:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  4:37 [PATCH 0/3] Make git more user-friendly during a merge conflict Andrew Wong
2014-03-14  4:37 ` [PATCH 1/3] wt-status: Make status messages more consistent with others Andrew Wong
2014-03-17 21:51   ` Junio C Hamano
2014-03-14  4:37 ` Andrew Wong [this message]
2014-03-17 21:58   ` [PATCH 2/3] merge: Advise user to use "git merge --abort" to abort merges Junio C Hamano
2014-03-14  4:37 ` [PATCH 3/3] reset: Print a warning when user uses "git reset" during a merge Andrew Wong
2014-03-14 14:33   ` Marc Branchaud
2014-03-14 17:04     ` Andrew Wong
2014-03-14 20:55       ` Junio C Hamano
2014-03-14 21:35         ` Andrew Wong
2014-03-15 19:23         ` Marc Branchaud
2014-03-17 21:54   ` Junio C Hamano
2014-03-17 23:04 ` [PATCH 0/3] Make git more user-friendly during a merge conflict Junio C Hamano
2014-03-17 23:25   ` Andrew Wong
2014-03-19 22:30     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394771872-25940-3-git-send-email-andrew.kw.w@gmail.com \
    --to=andrew.kw.w@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).