1 # Shell library for working with "chunk" files (commit-graph, midx, etc).
3 # corrupt_chunk_file <fn> <chunk> <offset> <bytes>
5 # Corrupt a chunk-based file (like a commit-graph) by overwriting the bytes
6 # found in the chunk specified by the 4-byte <chunk> identifier. If <offset> is
7 # "clear", replace the chunk entirely. Otherwise, overwrite data <offset> bytes
10 # The <bytes> are interpreted as pairs of hex digits (so "000000FE" would be
12 corrupt_chunk_file
() {
14 perl
"$TEST_DIRECTORY"/lib-chunk
/corrupt-chunk-file.pl \
15 "$@" <"$fn" >"$fn.tmp" &&
16 # some vintages of macOS 'mv' fails to overwrite a read-only file.