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

Re: Possible bug with `export-subst' attribute

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 26, 2010, 19:04 UTC
Message-ID
<20100726190448.GA32367@burratino>
In-Reply-To
<7vbp9uaii2.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> The ones to archive and checkout I understand, but what effect does the
> one to commit.c::print_summary() have?
Currently commit.c::print_summary() does this:
	struct strbuf format = STRBUF_INIT;
	...
	strbuf_addstr(&format, "format:%h] %s");
	[+ other bits for the commit notice]
	rev.abbrev = 0;
	rev.diff = 1;
	...
	get_commit_format(format.buf, &rev)
	...
	printf("[%s%s ",
			[branch name " (root-commit)"]);
	if (!log_tree_commit(&rev, commit)) {
		...

In other words, it imbues rev with a format including %h and uses that to print a commit summary.

That code is as old as builtin commit (v1.5.4-rc0~78^2~30, 2007-11-08) and was meant to imitate a diff-tree invocation (which is plumbing).

-- %< --
Subject: examples/commit: use --abbrev for commit summary

After v1.7.1.1~17^2~3 (pretty: Respect --abbrev option, 2010-05-03), plumbing users do not abbreviate %h hashes by default any more.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 If this seems to be a problem elsewhere, we will have to decouple
 the remembered --abbrev setting for %h from that for --raw output.
diff --git i/contrib/examples/git-commit.sh w/contrib/examples/git-commit.sh
index 5c72f65..23ffb02 100755
--- i/contrib/examples/git-commit.sh
+++ w/contrib/examples/git-commit.sh
@@ -631,7 +631,7 @@ then
 	if test -z "$quiet"
 	then
 		commit=`git diff-tree --always --shortstat --pretty="format:%h: %s"\
-		       --summary --root HEAD --`
+		       --abbrev --summary --root HEAD --`
 		echo "Created${initial_commit:+ initial} commit $commit"
 	fi
 fi
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 15 in “Possible bug with `export-subst' attribute”
  1. Eli BarzilayJul 25, 2010
  2. Ilari LiusvaaraJul 25, 2010
  3. Jonathan NiederJul 25, 2010
  4. Eli BarzilayJul 25, 2010
  5. Junio C HamanoJul 26, 2010
  6. Jonathan NiederJul 26, 2010
  7. Junio C HamanoJul 27, 2010
  8. 0/3 archive: abbreviate substituted commit ids againJonathan Nieder, Jul 27, 2010
  9. 1/3 archive: abbreviate substituted commit ids againJonathan Nieder, Jul 27, 2010
  10. 2/3 checkout, commit: remove confusing assignments to rev.abbrevJonathan Nieder, Jul 27, 2010
  11. Will PalmerJul 27, 2010
  12. Jonathan NiederJul 27, 2010
  13. Will PalmerJul 28, 2010
  14. Junio C HamanoJul 28, 2010
  15. 3/3 examples/commit: use --abbrev for commit summaryJonathan Nieder, Jul 27, 2010

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.