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

[PATCH v2 2/3] blame: honor core.abbrev

From
Namhyung Kim <namhyung@gmail.com>
Date
Apr 6, 2011, 02:20 UTC
Message-ID
<1302056452-5387-2-git-send-email-namhyung@gmail.com>
In-Reply-To
<1302056452-5387-1-git-send-email-namhyung@gmail.com>

If user sets config.abbrev option, use it as if --abbrev was given. This is the default value and user can override different abbrev length by specifing --abbrev=N command line option.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 builtin/blame.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index 253b480..4639788 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -41,7 +41,7 @@ static int reverse;
 static int blank_boundary;
 static int incremental;
 static int xdl_opts;
-static int abbrev = 8;
+static int abbrev = -1;
 
 static enum date_mode blame_date_mode = DATE_ISO8601;
 static size_t blame_date_width;
@@ -2347,6 +2347,11 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 parse_done:
 	argc = parse_options_end(&ctx);
 
+	if (abbrev == -1)
+		abbrev = default_abbrev;
+	/* one more abbrev length is needed for the boundary commit */
+	abbrev++;
+
 	if (revs_file && read_ancestry(revs_file))
 		die_errno("reading graft file '%s' failed", revs_file);
 
-- 
1.7.4
Previous: Namhyung KimNext: Namhyung Kim
Message 2 of 6 in “blame: add --abbrev command line option”
  1. 1/3 blame: add --abbrev command line optionNamhyung Kim, Apr 6, 2011
  2. 2/3 blame: honor core.abbrevNamhyung Kim, Apr 6, 2011
  3. 3/3 Documentation: add --abbrev option to the man page of git blameNamhyung Kim, Apr 6, 2011
  4. Thiago FarinaApr 6, 2011
  5. Junio C HamanoApr 6, 2011
  6. Namhyung KimApr 6, 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.