]> git.ipfire.org Git - thirdparty/git.git/commit
git-cvsexportcommit: port to SHA-256
authorbrian m. carlson <sandals@crustytoothpaste.net>
Mon, 22 Jun 2020 18:04:18 +0000 (18:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Jun 2020 18:21:07 +0000 (11:21 -0700)
commit6e9c4d408dfa842b22d612b7a6f1242bba2a5479
treef84c0fdd881b3b777dbc6e72c770fdd34d9b7ba4
parentf3eaa09261c25813c84a0e47ce8a4dd1b9f5b717
git-cvsexportcommit: port to SHA-256

When we apply a binary patch, we must have the full object ID in the
header in order to apply it; without that, any attempt to apply it will
fail.  If we set GIT_DIR to empty, git apply does not know about the
hash algorithm we're using, and consequently any attempt to apply a
patch using SHA-256 will fail, since the object ID is the wrong length.

The reason we set the GIT_DIR environment variable is because we don't
want to modify the index; we just want to know whether the patch
applies.  Instead, let's just use a temporary file for the index, which
will be cleaned up automatically when the object goes out of scope.

Additionally, read the configuration for the repository and compute the
length of an object ID based on it.  Use that when matching object IDs
with a regex or computing the all-zeros object ID.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-cvsexportcommit.perl