Skip to content

Commit

Permalink
archive: abbreviate substituted commit ids again
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
jrn authored and gitster committed Jul 27, 2010
1 parent 9a9fb5d commit 35039ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion t/t5001-archive-attr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 35039ce

Please sign in to comment.