git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/6] merge: move error message given when a merge needs committing to advice.c

From
SRStephen Robin <stephen.robin@gmail.com>
Date
May 6, 2015, 00:00 UTC
Message-ID
<1430870453-5408-3-git-send-email-stephen.robin@gmail.com>
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
Previous: Stephen RobinNext: Stephen Robin
Message 6 of 13 in “GSoC 2015: 2 accepted proposals”
  1. Matthieu MoyApr 27, 2015
  2. Paul TanApr 28, 2015
  3. Johannes SchindelinApr 29, 2015
  4. 0/6 Make pull a builtinStephen Robin, May 6, 2015
  5. 1/6 merge: tidy up optionsStephen Robin, May 6, 2015
  6. 2/6 merge: move error message given when a merge needs committing to advice.cStephen Robin, May 6, 2015
  7. 3/6 merge-base: split handle_fork_point to make reuse easierStephen Robin, May 6, 2015
  8. 4/6 pull: reimplement as a builtin in CStephen Robin, May 6, 2015
  9. 5/6 pull: allow interactive rebaseStephen Robin, May 6, 2015
  10. Johannes SchindelinMay 6, 2015
  11. 6/6 parse-remote: dismantle git-parse-remote.shStephen Robin, May 6, 2015
  12. Paul TanMay 6, 2015
  13. karthik nayakApr 28, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.