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

[PATCH] sequencer.c: abbreviate hashs placed in the middle of messages

From
Ralf Thielow <ralf.thielow@gmail.com>
Date
May 8, 2015, 16:53 UTC
Message-ID
<1431104035-2056-1-git-send-email-ralf.thielow@gmail.com>

Printing a 40 character sha1 hash in the middle of a message stretches the sentence a lot. Print the abbreviated version instead.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
 sequencer.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index c4f4b7d..2a39ab6 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -498,20 +498,21 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
 		struct commit_list *p;
 
 		if (!opts->mainline)
-			return error(_("Commit %s is a merge but no -m option was given."),
-				sha1_to_hex(commit->object.sha1));
+			return error(_("Commit %s... is a merge but no -m option was given."),
+				find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
 
 		for (cnt = 1, p = commit->parents;
 		     cnt != opts->mainline && p;
 		     cnt++)
 			p = p->next;
 		if (cnt != opts->mainline || !p)
-			return error(_("Commit %s does not have parent %d"),
-				sha1_to_hex(commit->object.sha1), opts->mainline);
+			return error(_("Commit %s... does not have parent %d"),
+				find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),
+				opts->mainline);
 		parent = p->item;
 	} else if (0 < opts->mainline)
-		return error(_("Mainline was specified but commit %s is not a merge."),
-			sha1_to_hex(commit->object.sha1));
+		return error(_("Mainline was specified but commit %s... is not a merge."),
+			find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
 	else
 		parent = commit->parents->item;
 
-- 
2.4.0.228.gc627b12
Next: Eric Sunshine
Message 1 of 14 in “sequencer.c: abbreviate hashs placed in the middle of messages”
  1. sequencer.c: abbreviate hashs placed in the middle of messagesRalf Thielow, May 8, 2015
  2. Eric SunshineMay 8, 2015
  3. Ralf ThielowMay 8, 2015
  4. Junio C HamanoMay 8, 2015
  5. Ralf ThielowMay 8, 2015
  6. Junio C HamanoMay 8, 2015
  7. Ralf ThielowMay 8, 2015
  8. Junio C HamanoMay 8, 2015
  9. Ralf ThielowMay 8, 2015
  10. Junio C HamanoMay 8, 2015
  11. Ralf ThielowMay 8, 2015
  12. Matthieu MoyMay 10, 2015
  13. Junio C HamanoMay 10, 2015
  14. Matthieu MoyMay 10, 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.