git-commit-vandalism/Documentation/technical
Derrick Stolee d96075428a multi-pack-index: use hash version byte
Similar to the commit-graph format, the multi-pack-index format has a
byte in the header intended to track the hash version used to write the
file. This allows one to interpret the hash length without having the
context of the repository config specifying the hash length. This was
not modified as part of the SHA-256 work because the hash length was
automatically up-shifted due to that config.

Since we have this byte available, we can make the file formats more
obviously incompatible instead of relying on other context from the
repository.

Add a new oid_version() method in midx.c similar to the one in
commit-graph.c. This is specifically made separate from that
implementation to avoid artificially linking the formats.

The test impact requires a few more things than the corresponding change
in the commit-graph format. Specifically, 'test-tool read-midx' was not
writing anything about this header value to output. Since the value
available in 'struct multi_pack_index' is hash_len instead of a version
value, we output "20" or "32" instead of "1" or "2".

Since we want a user to not have their Git commands fail if their
multi-pack-index has the incorrect hash version compared to the
repository's hash version, we relax the die() to an error() in
load_multi_pack_index(). This has some effect on 'git multi-pack-index
verify' as we need to check that a failed parse of a file that exists is
actually a verify error. For that test that checks the hash version
matches, we change the corrupted byte from "2" to "3" to ensure the test
fails for both hash algorithms.

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>
2020-08-17 16:45:20 -07:00
..
.gitignore
api-error-handling.txt
api-index-skel.txt
api-index.sh
api-merge.txt merge: move doc to ll-merge.h 2019-11-18 15:21:28 +09:00
api-parse-options.txt strvec: update documention to avoid argv_array 2020-07-28 15:02:18 -07:00
api-trace2.txt trace2: teach Git to log environment variables 2020-03-23 13:14:53 -07:00
bitmap-format.txt
bundle-format.txt bundle: add new version for use with SHA-256 2020-07-30 09:16:48 -07:00
commit-graph-format.txt commit-graph: use the "hash version" byte 2020-08-17 16:45:14 -07:00
commit-graph.txt Merge branch 'jk/lore-is-the-archive' 2019-12-06 15:09:23 -08:00
directory-rename-detection.txt
hash-function-transition.txt Merge branch 'jk/lore-is-the-archive' 2019-12-06 15:09:23 -08:00
http-protocol.txt doc: fix wrong 4-byte length of pkt-line message 2020-05-21 10:52:01 -07:00
index-format.txt Documentation: fix a bunch of typos, both old and new 2019-11-07 13:42:00 +09:00
long-running-process-protocol.txt
multi-pack-index.txt Merge branch 'jb/doc-multi-pack-idx-fix' 2020-01-08 12:44:12 -08:00
pack-format.txt multi-pack-index: use hash version byte 2020-08-17 16:45:20 -07:00
pack-heuristics.txt
pack-protocol.txt doc: fix wrong 4-byte length of pkt-line message 2020-05-21 10:52:01 -07:00
packfile-uri.txt Documentation: add Packfile URIs design doc 2020-06-10 18:06:34 -07:00
partial-clone.txt Merge branch 'jk/lore-is-the-archive' 2019-12-06 15:09:23 -08:00
protocol-capabilities.txt Documentation: document v1 protocol object-format capability 2020-05-13 18:14:08 -07:00
protocol-common.txt
protocol-v2.txt Merge branch 'bc/sha-256-part-2' 2020-07-06 22:09:13 -07:00
racy-git.txt doc: replace LKML link with lore.kernel.org 2019-12-04 10:26:52 -08:00
reftable.txt reftable: define version 2 of the spec to accomodate SHA256 2020-06-09 13:48:36 -07:00
repository-version.txt
rerere.txt Documentation: fix a bunch of typos, both old and new 2019-11-07 13:42:00 +09:00
send-pack-pipeline.txt
shallow.txt
signature-format.txt
trivial-merge.txt