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

[PATCH] error_resolve_conflict: rewrap advice message

From
Jeff King <peff@peff.net>
Date
Jun 3, 2014, 07:17 UTC
Message-ID
<20140603071717.GA32038@sigill.intra.peff.net>

If you try to commit with unresolved conflicts in the index, you get this message:

	$ git commit
	U       foo
	error: 'commit' is not possible because you have unmerged files.
	hint: Fix them up in the work tree,
	hint: and then use 'git add/rm <file>' as
	hint: appropriate to mark resolution and make a commit,
	hint: or use 'git commit -a'.
	fatal: Exiting because of an unresolved conflict.

The irregular line-wrapping makes this awkward to read, and it takes up more lines than necessary. Instead, let's rewrap it to about 60 characters per line:

	$ git commit
	U       foo
	error: 'commit' is not possible because you have unmerged files.
	hint: Fix them up in the work tree, and then use 'git add/rm <file>'
	hint: as appropriate to mark resolution and make a commit, or use
	hint: 'git commit -a'.
	fatal: Exiting because of an unresolved conflict.
Signed-off-by: Jeff King <peff@peff.net>
---
This always bugs me when I see it, so I thought I'd finally do something
about it. I left the wording alone, though I'd also be happy to see it
shortened to just advise "git add/rm" and not mention "git commit -a" at
all.
 advice.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/advice.c b/advice.c
index 486f823..ef24733 100644
--- a/advice.c
+++ b/advice.c
@@ -82,10 +82,9 @@ int error_resolve_conflict(const char *me)
 		 * Message used both when 'git commit' fails and when
 		 * other commands doing a merge do.
 		 */
-		advise(_("Fix them up in the work tree,\n"
-			 "and then use 'git add/rm <file>' as\n"
-			 "appropriate to mark resolution and make a commit,\n"
-			 "or use 'git commit -a'."));
+		advise(_("Fix them up in the work tree, and then use 'git add/rm <file>'\n"
+			 "as appropriate to mark resolution and make a commit, or use\n"
+			 "'git commit -a'."));
 	return -1;
 }
 
-- 
2.0.0.rc1.436.g03cb729
Next: Jeff King
Message 1 of 3 in “error_resolve_conflict: rewrap advice message”
  1. error_resolve_conflict: rewrap advice messageJeff King, Jun 3, 2014
  2. error_resolve_conflict: drop quotations around operationJeff King, Jun 3, 2014
  3. Junio C HamanoJun 3, 2014

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.