Re: Possible bug with `export-subst' attribute
flat view
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:11
Ilari Liusvaara wrote:
I remember seeing similar stuff. It isn't just archive, I also rember seeing commit printing full hashes in that informational line it prints when it has made the commit (IIRC, normally that hash is abbrevated).
My bad. Would something like this fix it? -- 8< -- Subject: archive, commit: use --abbrev by default again v1.7.1.1~17^2~3 (pretty: Respect --abbrev option, 2010-05-03) taught git log --format=%h to respect the --abbrev option instead of always abbreviating, with the side-effect that we have to pay attention to the abbrev setting now. For example, the "git archive" export-subst feature and the informational line printed by "git commit" are using unabbreviated object names now, the former because full object names are the low-level default, the latter because it was first written to imitate plumbing. Fix them. While at it, remove a similar confusing assignment of 0 to rev.abbrev in "git checkout" which had no effect. Signed-off-by: Jonathan Nieder <redacted> ---
diff --git i/archive.c w/archive.c
index d700af3..edd6853 100644
--- i/archive.c
+++ w/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 i/builtin/checkout.c w/builtin/checkout.c
index 1994be9..eef2b48 100644
--- i/builtin/checkout.c
+++ w/builtin/checkout.c@@ -279,7 +279,6 @@ static void show_local_changes(struct object *head) struct rev_info rev; /* I think we want full paths, even if we're in a subdirectory. */ init_revisions(&rev, NULL); - rev.abbrev = 0; rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS; if (diff_setup_done(&rev.diffopt) < 0) die("diff_setup_done failed");
diff --git i/builtin/commit.c w/builtin/commit.c
index a78dbd8..ae4831e 100644
--- i/builtin/commit.c
+++ w/builtin/commit.c@@ -1163,7 +1163,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1) init_revisions(&rev, prefix); setup_revisions(0, NULL, &rev, NULL); - rev.abbrev = 0; + rev.abbrev = DEFAULT_ABBREV; rev.diff = 1; rev.diffopt.output_format = DIFF_FORMAT_SHORTSTAT | DIFF_FORMAT_SUMMARY;
--