diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2020-08-17 14:04:47 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-17 16:45:14 -0700 |
commit | 665d70ad033b115d8c14cdc2bcecf6c8b1947260 (patch) | |
tree | 17aa7445a44722996df856cf93c57a87019c3846 /t/t6044-merge-unrelated-index-changes.sh | |
parent | t/README: document GIT_TEST_DEFAULT_HASH (diff) | |
download | tgif-665d70ad033b115d8c14cdc2bcecf6c8b1947260.tar.xz |
commit-graph: use the "hash version" byte
The commit-graph format reserved a byte among the header of the file to
store a "hash version". During the SHA-256 work, this was not modified
because file formats are not necessarily intended to work across hash
versions. If a repository has SHA-256 as its hash algorithm, it
automatically up-shifts the lengths of object names in all necessary
formats.
However, since we have this byte available for adjusting the version, we
can make the file formats more obviously incompatible instead of relying
on other context from the repository.
Update the oid_version() method in commit-graph.c to add a new value, 2,
for sha-256. This automatically writes the new value in a SHA-256
repository _and_ verifies the value is correct. This is a breaking
change relative to the current 'master' branch since 092b677 (Merge
branch 'bc/sha-256-cvs-svn-updates', 2020-08-13) but it is not breaking
relative to any released version of Git.
The test impact is relatively minor: the output of 'test-tool
read-graph' lists the header information, so those instances of '1' need
to be replaced with a variable determined by GIT_TEST_DEFAULT_HASH. A
more careful test is added that specifically creates a repository of
each type then swaps the commit-graph files. The important value here is
that the "git log" command succeeds while writing a message to stderr.
Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6044-merge-unrelated-index-changes.sh')
0 files changed, 0 insertions, 0 deletions