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

[PATCH] blame: honor core.abbrevguard

From
Namhyung Kim <namhyung@gmail.com>
Date
Mar 7, 2011, 04:35 UTC
Message-ID
<1299472540-6066-1-git-send-email-namhyung@gmail.com>

Commit 72a5b561 ("core.abbrevguard: Ensure short object names stay unique a bit longer") introduced this config variable to make object name unambiguously. Use it.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 builtin/blame.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index aa30ec52692..d1cf22beba1 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1664,14 +1664,22 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 	struct commit_info ci;
 	char hex[41];
 	int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
+	int length;
 
 	get_commit_info(suspect->commit, &ci, 1);
 	strcpy(hex, sha1_to_hex(suspect->commit->object.sha1));
 
+	if (opt & OUTPUT_LONG_OBJECT_NAME)
+		length = 40;
+	else {
+		length = 8 + unique_abbrev_extra_length;
+		if (length > 40)
+			length = 40;
+	}
+
 	cp = nth_line(sb, ent->lno);
 	for (cnt = 0; cnt < ent->num_lines; cnt++) {
 		char ch;
-		int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;
 
 		if (suspect->commit->object.flags & UNINTERESTING) {
 			if (blank_boundary)
-- 
1.7.4
Next: Namhyung Kim
Message 1 of 4 in “blame: honor core.abbrevguard”
  1. blame: honor core.abbrevguardNamhyung Kim, Mar 7, 2011
  2. blame: honor core.abbrevguardNamhyung Kim, Mar 7, 2011
  3. Junio C HamanoMar 8, 2011
  4. Namhyung KimMar 8, 2011

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.