git.vger.kernel.org archive mirror
 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: [PATCH 1/3] archive: abbreviate substituted commit ids again
Date: Tue, 27 Jul 2010 13:32:36 -0500	[thread overview]
Message-ID: <20100727183236.GC5578@burratino> (raw)
In-Reply-To: <20100727182942.GB5578@burratino>

Given a file with:

  (define archive-id "$Format:%ct|%h|a$")

and an export-subst attribute, the "%h" results in an full 40-digit
object name instead of the expected 7-digit one.

The export-subst feature requests unabbreviated object names because
that is the low-level default.  The effect was not observable until
v1.7.1.1~17^2~3 (2010-05-03), which taught log --format=%h to respect
the --abbrev option.

Reported-by: Eli Barzilay <eli@barzilay.org>
Tested-by: Eli Barzilay <eli@barzilay.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
I carried over the tested-by; I hope that’s okay.  Well, I’ve tested
the new patch myself, at least. :)

 archive.c               |    1 +
 t/t5001-archive-attr.sh |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/archive.c b/archive.c
index d700af3..edd6853 100644
--- a/archive.c
+++ b/archive.c
@@ -33,6 +33,7 @@ static void format_subst(const struct commit *commit,
 	struct strbuf fmt = STRBUF_INIT;
 	struct pretty_print_context ctx = {0};
 	ctx.date_mode = DATE_NORMAL;
+	ctx.abbrev = DEFAULT_ABBREV;
 
 	if (src == buf->buf)
 		to_free = strbuf_detach(buf, NULL);
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 426b319..02d4d22 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -4,7 +4,7 @@ test_description='git archive attribute tests'
 
 . ./test-lib.sh
 
-SUBSTFORMAT=%H%n
+SUBSTFORMAT='%H (%h)%n'
 
 test_expect_exists() {
 	test_expect_success " $1 exists" "test -e $1"
-- 
1.7.2.21.g04ff

  reply	other threads:[~2010-07-27 18:33 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
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             ` Jonathan Nieder [this message]
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=20100727183236.GC5578@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).