Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/lib-chunk.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / lib-chunk.sh` 18 lines ยท 697 bytes Raw Blame History 1 # Shell library for working with "chunk" files (commit-graph, midx, etc). 2 3 # corrupt_chunk_file 4 # 5 # Corrupt a chunk-based file (like a commit-graph) by overwriting the bytes 6 # found in the chunk specified by the 4-byte identifier. If is 7 # "clear", replace the chunk entirely. Otherwise, overwrite data bytes 8 # into the chunk. 9 # 10 # The 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 # some vintages of macOS 'mv' fails to overwrite a read-only file. 17 mv -f "$fn.tmp" "$fn" 18 }