All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
	Eli Barzilay <eli@barzilay.org>,
	git@vger.kernel.org, Will Palmer <wmpalmer@gmail.com>
Subject: Re: Possible bug with `export-subst' attribute
Date: Mon, 26 Jul 2010 14:04:48 -0500	[thread overview]
Message-ID: <20100726190448.GA32367@burratino> (raw)
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
-- 

  reply	other threads:[~2010-07-26 19:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-25  9:08 Possible bug with `export-subst' attribute Eli Barzilay
2010-07-25 13:09 ` Ilari Liusvaara
2010-07-25 22:15   ` Jonathan Nieder
2010-07-25 22:41     ` Eli Barzilay
2010-07-26  6:01     ` Junio C Hamano
2010-07-26 19:04       ` Jonathan Nieder [this message]
2010-07-27 17:35         ` Junio C Hamano
2010-07-27 18:29           ` [PATCH 0/3] archive: abbreviate substituted commit ids again Jonathan Nieder
2010-07-27 18:32             ` [PATCH 1/3] " Jonathan Nieder
2010-07-27 18:37             ` [PATCH 2/3] checkout, commit: remove confusing assignments to rev.abbrev Jonathan Nieder
2010-07-27 20:18               ` Will Palmer
2010-07-27 21:09                 ` Jonathan Nieder
2010-07-28 10:01                   ` Will Palmer
2010-07-28 17:23                     ` Junio C Hamano
2010-07-27 18:44             ` [PATCH 3/3] examples/commit: use --abbrev for commit summary Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100726190448.GA32367@burratino \
    --to=jrnieder@gmail.com \
    --cc=eli@barzilay.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ilari.liusvaara@elisanet.fi \
    --cc=wmpalmer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.