t3404: prepare 'short SHA-1 collision' tests for SHA-256
authorJohannes Schindelin <redacted>
Wed, 29 Jul 2020 23:13:53 +0000 (23:13 +0000)
committerJunio C Hamano <redacted>
Thu, 30 Jul 2020 16:16:45 +0000 (09:16 -0700)
commit800e6a7041961b91fb97ab5dfd440983953fe75c
treeffef61bf175eb5be76440cfbec62fdd0e42fdaad
parent9e3bd8a391a3a2a486e4cff6ff7b4de2bac5a15d
t3404: prepare 'short SHA-1 collision' tests for SHA-256

The idea of the magic value "ac4f2ee" in this test is to make the
reworded commit `collide2` have the same shortened ID as the commit
`collide3`.

To port the same idea to the SHA-256 version of Git, we therefore need
another magic value that causes the same collision, but this time with
the SHA-256 version of the commit IDs.

In this patch, we add code guarded by `GIT_TEST_FIND_COLLIDER` to do
exactly that. Essentially, a large number of integers is appended to the
commit message "collide2" to find such a collision. To make it easier to
find such a collision, we reduce the number of digits to 4.

As the tests are no longer dependent on SHA-1, we also rename their
titles to talk about "commit IDs" instead of "SHA-1s".

Signed-off-by: Johannes Schindelin <redacted>
Signed-off-by: brian m. carlson <redacted>
Reviewed-by: Eric Sunshine <redacted>
Signed-off-by: Junio C Hamano <redacted>
t/t3404-rebase-interactive.sh
git clone https://git.99rst.org/PROJECT