git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] commit: show abbreviated sha for commits with empty diffs

From
Tay Ray Chuan <rctay89@gmail.com>
Date
May 24, 2010, 09:47 UTC
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 <rctay89@gmail.com>
---
 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
Previous: Tay Ray ChuanNext: Junio C Hamano
Message 4 of 17 in “commit: fix abbrev-sha regression”
  1. 0/3 commit: fix abbrev-sha regressionTay Ray Chuan, May 24, 2010
  2. 1/3 t7502-commit: add tests for summary outputTay Ray Chuan, May 24, 2010
  3. 2/3 t7502-commit: add summary output tests for empty and merge commitsTay Ray Chuan, May 24, 2010
  4. 3/3 commit: show abbreviated sha for commits with empty diffsTay Ray Chuan, May 24, 2010
  5. Junio C HamanoMay 26, 2010
  6. Tay Ray ChuanMay 26, 2010
  7. Tay Ray ChuanMay 26, 2010
  8. Junio C HamanoMay 26, 2010
  9. Tay Ray ChuanMay 26, 2010
  10. 0/3 commit: fix abbrev-sha regressionTay Ray Chuan, May 27, 2010
  11. 1/3 t7502-commit: add tests for summary outputTay Ray Chuan, May 27, 2010
  12. 2/3 t7502-commit: add summary output tests for empty and merge commitsTay Ray Chuan, May 27, 2010
  13. 3/3 commit::print_summary(): set rev_info.always_show_header to 1Tay Ray Chuan, May 27, 2010
  14. Junio C HamanoMay 29, 2010
  15. Tay Ray ChuanMay 29, 2010
  16. 3/3 commit::print_summary(): don't use format_commit_message()Tay Ray Chuan, Jun 12, 2010
  17. Will PalmerMay 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.