All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Robin <stephen.robin@gmail.com>
To: pyokagan@gmail.com
Cc: git@vger.kernel.org
Subject: [PATCH 2/6] merge: move error message given when a merge needs committing to advice.c
Date: Wed,  6 May 2015 01:00:49 +0100	[thread overview]
Message-ID: <1430870453-5408-3-git-send-email-stephen.robin@gmail.com> (raw)
In-Reply-To: <1430870453-5408-1-git-send-email-stephen.robin@gmail.com>

THIS PATCH SERIES IS NOT CODE-COMPLETE OR FULLY TESTED.
See code comments beginning TODO for work remaining.

This will allow the message to be re-used in other places.

Signed-off-by: Stephen Robin <stephen.robin@gmail.com>
---
 advice.c        | 9 +++++++++
 advice.h        | 1 +
 builtin/merge.c | 6 +-----
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/advice.c b/advice.c
index 575bec2..747792e 100644
--- a/advice.c
+++ b/advice.c
@@ -96,6 +96,15 @@ void NORETURN die_resolve_conflict(const char *me)
 	die("Exiting because of an unresolved conflict.");
 }
 
+void NORETURN die_merge_in_progress()
+{
+	if (advice_resolve_conflict)
+		die(_("You have not concluded your merge (MERGE_HEAD exists).\n"
+		"Please, commit your changes before you merge."));
+	else
+		die(_("You have not concluded your merge (MERGE_HEAD exists)."));
+}
+
 void detach_advice(const char *new_name)
 {
 	const char fmt[] =
diff --git a/advice.h b/advice.h
index 5ecc6c1..75c261a 100644
--- a/advice.h
+++ b/advice.h
@@ -24,6 +24,7 @@ __attribute__((format (printf, 1, 2)))
 void advise(const char *advice, ...);
 int error_resolve_conflict(const char *me);
 extern void NORETURN die_resolve_conflict(const char *me);
+extern void NORETURN die_merge_in_progress();
 void detach_advice(const char *new_name);
 
 #endif /* ADVICE_H */
diff --git a/builtin/merge.c b/builtin/merge.c
index d6b0579..45d93bb 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1134,11 +1134,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		 * There is no unmerged entry, don't advise 'git
 		 * add/rm <file>', just 'git commit'.
 		 */
-		if (advice_resolve_conflict)
-			die(_("You have not concluded your merge (MERGE_HEAD exists).\n"
-				  "Please, commit your changes before you merge."));
-		else
-			die(_("You have not concluded your merge (MERGE_HEAD exists)."));
+		die_merge_in_progress();
 	}
 	if (file_exists(git_path("CHERRY_PICK_HEAD"))) {
 		if (advice_resolve_conflict)
-- 
2.4.0.7.gf20f26f

  parent reply	other threads:[~2015-05-06  0:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 19:50 GSoC 2015: 2 accepted proposals Matthieu Moy
2015-04-28  8:58 ` Paul Tan
2015-04-29 15:27   ` Johannes Schindelin
2015-05-06  0:00   ` [PATCH 0/6] Make pull a builtin Stephen Robin
2015-05-06  0:00     ` [PATCH 1/6] merge: tidy up options Stephen Robin
2015-05-06  0:00     ` Stephen Robin [this message]
2015-05-06  0:00     ` [PATCH 3/6] merge-base: split handle_fork_point to make reuse easier Stephen Robin
2015-05-06  0:00     ` [PATCH 4/6] pull: reimplement as a builtin in C Stephen Robin
2015-05-06  0:00     ` [PATCH 5/6] pull: allow interactive rebase Stephen Robin
2015-05-06  5:43       ` Johannes Schindelin
2015-05-06  0:00     ` [PATCH 6/6] parse-remote: dismantle git-parse-remote.sh Stephen Robin
2015-05-06  4:27     ` [PATCH 0/6] Make pull a builtin Paul Tan
2015-04-28 12:17 ` GSoC 2015: 2 accepted proposals karthik nayak

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=1430870453-5408-3-git-send-email-stephen.robin@gmail.com \
    --to=stephen.robin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pyokagan@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.