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

[PATCH 3/3] t3404: simplify short SHA-1 collision test

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 21, 2013, 19:12 UTC
Message-ID
<1377112378-45511-4-git-send-email-sunshine@sunshineco.com>
In-Reply-To
<1377112378-45511-1-git-send-email-sunshine@sunshineco.com>

The short SHA-1 collision test employs two "magic" values in commit messages to trigger an "ambiguous SHA-1 error" during 'rebase -i' -- one for 'collide3' during setup, and one for 'collide2' at rebase time -- even though the collision can just as easily be triggered by a single magic value at rebase time only. The setup-time 'collide3' magic value serves no purpose [1], but can easily mislead readers into thinking that it is somehow significant even though it is not. Drop this unneeded bit of magic.

As a side-effect, this also simplifies the setup-time "test_commit collide3" invocation, making it easier to read.

[1]: The magic value on 'collide3' gave it a short SHA-1 prefix of "badbeef" which could be spotted easily in verbose output during development of the test, but is otherwise not meaningful or helpful.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
 t/t3404-rebase-interactive.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 7d15c7a..50e22b1 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -1058,7 +1058,7 @@ test_expect_success 'short SHA-1 setup' '
 	unset test_tick &&
 	test_commit collide1 collide &&
 	test_commit --notick collide2 collide &&
-	test_commit --notick "collide3 115158b5" collide collide3 collide3
+	test_commit --notick collide3 collide
 	)
 '
 
@@ -1069,7 +1069,7 @@ test_expect_success 'short SHA-1 collide' '
 	unset test_tick &&
 	test_tick &&
 	set_fake_editor &&
-	FAKE_COMMIT_MESSAGE="collide2 815200e" \
+	FAKE_COMMIT_MESSAGE="collide2 ac4f2ee" \
 	FAKE_LINES="reword 1 2" git rebase -i HEAD~2
 	)
 '
-- 
1.8.4.rc4.499.gfb33910
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 12 in “t3404 incremental improvements”
  1. 0/3 t3404 incremental improvementsEric Sunshine, Aug 21, 2013
  2. 1/3 t3404: preserve test_tick state across short SHA-1 collision testEric Sunshine, Aug 21, 2013
  3. Jonathan NiederAug 25, 2013
  4. Eric SunshineAug 25, 2013
  5. Jonathan NiederAug 25, 2013
  6. Junio C HamanoAug 26, 2013
  7. 2/3 t3404: make tests more self-containedEric Sunshine, Aug 21, 2013
  8. Junio C HamanoAug 21, 2013
  9. 3/3 t3404: simplify short SHA-1 collision testEric Sunshine, Aug 21, 2013
  10. Junio C HamanoAug 21, 2013
  11. Eric SunshineAug 22, 2013
  12. Junio C HamanoAug 22, 2013

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.