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

[PATCH] t4205: correctly test %(describe:abbrev=...)

From
Kousik Sanagavarapu <five231003@gmail.com>
Date
Jun 28, 2023, 18:16 UTC
Message-ID
<20230628181753.10384-1-five231003@gmail.com>

The pretty format %(describe:abbrev=<number>) tells describe to use only <number> characters of the oid to generate the human-readable format of the commit-ish.

This is not apparent in the test for %(describe:abbrev=...) because we directly tag HEAD and use that, in which case the human-readable format is just the tag name. So, create a new commit and use that instead.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Kousik Sanagavarapu <five231003@gmail.com>
---
 t/t4205-log-pretty-formats.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 4cf8a77667..b631b5a142 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -1011,8 +1011,7 @@ test_expect_success '%(describe:tags) vs git describe --tags' '
 '
 
 test_expect_success '%(describe:abbrev=...) vs git describe --abbrev=...' '
-	test_when_finished "git tag -d tagname" &&
-	git tag -a -m tagged tagname &&
+	test_commit --no-tag file &&
 	git describe --abbrev=15 >expect &&
 	git log -1 --format="%(describe:abbrev=15)" >actual &&
 	test_cmp expect actual
-- 
2.41.0.29.g8148156d44.dirty
Next: Junio C Hamano
Message 1 of 4 in “t4205: correctly test %(describe:abbrev=...)”
  1. t4205: correctly test %(describe:abbrev=...)Kousik Sanagavarapu, Jun 28, 2023
  2. Junio C HamanoJun 28, 2023
  3. Kousik SanagavarapuJun 29, 2023
  4. t4205: correctly test %(describe:abbrev=...)Kousik Sanagavarapu, Jun 29, 2023

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.