From: Tay Ray Chuan Date: Mon, 24 May 2010 09:47:32 GMT Subject: [PATCH 3/3] commit: show abbreviated sha for commits with empty diffs Message-ID: <1274694452-4200-4-git-send-email-rctay89@gmail.com> In-Reply-To: <1274694452-4200-3-git-send-email-rctay89@gmail.com> Signed-off-by: Tay Ray Chuan --- builtin/commit.c | 1 + t/t7502-commit.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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); diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index 8a4a277..109ae00 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -36,12 +36,12 @@ test_expect_success 'output summary format' ' check_summary_oneline "" "a change" ' -test_expect_failure 'output summary format for commit with an empty diff' ' +test_expect_success 'output summary format for commit with an empty diff' ' check_summary_oneline "" "empty" "--allow-empty" ' -test_expect_failure 'output summary format for merges' ' +test_expect_success 'output summary format for merges' ' git checkout -b recursive-base && test_commit base file1 && -- 1.7.1.189.g07419