After c197702 (pretty: Respect --abbrev option), the summary output for git-commit began to throw up non-abbreviated SHA-1s. For example, $ git commit --allow-empty -m "empty" [master f869bf09c8eefee54094bb21387241aaf5f10324] empty I also notice that this happens for merges after conflict resolutions. This afflicts 'master', but not any release. Here's the hunk that fixed it: -->8-- diff --git a/builtin/commit.c b/builtin/commit.c index a4e4966..ab4a7cf 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1166,6 +1166,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1) struct pretty_print_context ctx = {0}; struct strbuf buf = STRBUF_INIT; ctx.date_mode = DATE_NORMAL; + ctx.abbrev = DEFAULT_ABBREV; format_commit_message(commit, format.buf + 7, &buf, &ctx); printf("%s\n", buf.buf); strbuf_release(&buf); -->8-- However, I noticed that this would also work: -->8-- diff --git a/builtin/commit.c b/builtin/commit.c index ab4a7cf..13a30ab 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1148,7 +1148,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1) rev.verbose_header = 1; rev.show_root_diff = 1; get_commit_format(format.buf, &rev); - rev.always_show_header = 0; + rev.always_show_header = 1; rev.diffopt.detect_rename = 1; rev.diffopt.rename_limit = 100; rev.diffopt.break_opt = 0; -->8-- This would make the code block that handled the situation in which log_tree_commit() did not print any output redundant, so perhaps this would also follow: -->8-- diff --git a/builtin/commit.c b/builtin/commit.c index ab4a7cf..e8def55 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1163,13 +1163,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1) initial_commit ? " (root-commit)" : ""); if (!log_tree_commit(&rev, commit)) { - struct pretty_print_context ctx = {0}; - struct strbuf buf = STRBUF_INIT; - ctx.date_mode = DATE_NORMAL; - ctx.abbrev = DEFAULT_ABBREV; - format_commit_message(commit, format.buf + 7, &buf, &ctx); - printf("%s\n", buf.buf); - strbuf_release(&buf); + die("unable to print summary"); } strbuf_release(&format); } -->8-- In a sense, it reverts parts of bf82a15 (commit: do not add extra LF at the end of the summary.), except for the extra LF. Would this be a more sensible route? Contents: [PATCH 0/3] commit: fix abbrev-sha regression [PATCH 1/3] t7502-commit: add tests for summary output [PATCH 2/3] t7502-commit: add summary output tests for empty and merge commits [PATCH 3/3] commit: show abbreviated sha for commits with empty diffs -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html