1
0
mirror of https://github.com/git/git.git synced 2024-10-19 18:48:25 +02:00
git/t/helper
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
test-advise.c advice: revamp advise API 2020-03-05 06:15:02 -08:00
test-bloom.c t: make test-bloom initialize repository 2020-07-30 09:16:45 -07:00
test-chmtime.c
test-config.c config: provide access to the current line number 2020-02-10 10:52:10 -08:00
test-ctype.c
test-date.c
test-delta.c
test-dir-iterator.c
test-drop-caches.c
test-dump-cache-tree.c
test-dump-fsmonitor.c fsmonitor: change last update timestamp on the index_state to opaque token 2020-01-13 14:58:43 -08:00
test-dump-split-index.c t/helper/test-dump-split-index: initialize git repository 2020-02-24 09:33:24 -08:00
test-dump-untracked-cache.c
test-example-decorate.c
test-fake-ssh.c
test-genrandom.c
test-genzeros.c
test-hash-speed.c
test-hash.c
test-hashmap.c
test-index-version.c
test-json-writer.c
test-lazy-init-name-hash.c
test-line-buffer.c
test-match-trees.c
test-mergesort.c
test-mktemp.c
test-oid-array.c t/helper: initialize the repository for test-sha1-array 2020-06-19 14:04:08 -07:00
test-oidmap.c
test-online-cpus.c
test-parse-options.c parse-options: add testcases for OPT_CMDMODE() 2020-02-20 13:20:40 -08:00
test-parse-pathspec-file.c test-parse-pathspec-file.c: s/0/NULL/ for pointer type 2020-04-27 11:21:12 -07:00
test-path-utils.c real_path: remove unsafe API 2020-03-10 11:41:40 -07:00
test-pkt-line.c pkt-line: define PACKET_READ_RESPONSE_END 2020-05-24 16:26:00 -07:00
test-prio-queue.c
test-progress.c progress.c: silence cgcc suggestion about internal linkage 2020-04-27 11:21:28 -07:00
test-reach.c Merge branch 'cb/is-descendant-of' 2020-07-06 22:09:16 -07:00
test-read-cache.c
test-read-graph.c Merge branch 'gs/commit-graph-path-filter' 2020-05-01 13:39:53 -07:00
test-read-midx.c multi-pack-index: use hash version byte 2020-08-17 16:45:20 -07:00
test-ref-store.c worktree: drop get_worktrees() unused 'flags' argument 2020-06-22 10:31:15 -07:00
test-regex.c t/helper: teach test-regex to report pattern errors (like REG_ILLSEQ) 2020-05-18 13:03:35 -07:00
test-repository.c t/helper: make repository tests hash independent 2020-02-24 09:33:27 -08:00
test-revision-walking.c
test-run-command.c strvec: rename struct fields 2020-07-30 19:18:06 -07:00
test-scrap-cache-tree.c
test-serve-v2.c
test-sha1.c
test-sha1.sh
test-sha256.c
test-sigchain.c
test-strcmp-offset.c
test-string-list.c
test-submodule-config.c
test-submodule-nested-repo-config.c
test-subprocess.c
test-svn-fe.c
test-tool.c Merge branch 'gs/commit-graph-path-filter' 2020-05-01 13:39:53 -07:00
test-tool.h Merge branch 'gs/commit-graph-path-filter' 2020-05-01 13:39:53 -07:00
test-trace2.c strvec: rename files from argv-array to strvec 2020-07-28 15:02:17 -07:00
test-urlmatch-normalization.c
test-wildmatch.c
test-windows-named-pipe.c use strpbrk(3) to search for characters from a given set 2020-02-24 09:30:31 -08:00
test-write-cache.c
test-xml-encode.c