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

[PATCH] checkout: abbreviate hash in suggest_reattach

From
Kevin Bracey <kevin@bracey.fi>
Date
Apr 8, 2013, 15:53 UTC
Message-ID
<1365436422-25554-1-git-send-email-kevin@bracey.fi>

After printing the list of left-behind commits (with abbreviated hashes), use an abbreviated hash in the suggested 'git branch' command; there's no point in outputting a full 40-character hex string in some friendly advice.

Signed-off-by: Kevin Bracey <kevin@bracey.fi>
---
 builtin/checkout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index a9c1b5a..e168bfb 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -700,7 +700,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
 			"If you want to keep them by creating a new branch, "
 			"this may be a good time\nto do so with:\n\n"
 			" git branch new_branch_name %s\n\n"),
-			sha1_to_hex(commit->object.sha1));
+			find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
 }
 
 /*
-- 
1.8.2.445.gfcda34b
Next: Jeff King
Message 1 of 2 in “checkout: abbreviate hash in suggest_reattach”
  1. checkout: abbreviate hash in suggest_reattachKevin Bracey, Apr 8, 2013
  2. Jeff KingApr 8, 2013

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.