Start the 2.46 cycle
[git/gitster.git] / t / lib-chunk.sh
bloba7cd9c3c6dff6e21eaf4420596809ddb8605730c
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
8 # into the chunk.
10 # The <bytes> are interpreted as pairs of hex digits (so "000000FE" would be
11 # big-endian 254).
12 corrupt_chunk_file () {
13 fn=$1; shift
14 perl "$TEST_DIRECTORY"/lib-chunk/corrupt-chunk-file.pl \
15 "$@" <"$fn" >"$fn.tmp" &&
16 mv "$fn.tmp" "$fn"