t/lib-chunk: work around broken "mv" on some vintage of macOS

When the destination is read-only, "mv" on some version of macOS asks whether to replace the destination even though in the test its stdin is not a terminal (and thus doesn't conform to POSIX[1]). The helper to corrupt a chunk-file is designed to work on the files like commit-graph and multi-pack-index files that are generally read-only, so use "mv -f" to work around this issue. Helped-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed May 2, 2024 at 13:15 UTC 861dc19ba852cf668b40d0ef601b44c7c03853a1
1 file changed +2 -1
t/lib-chunk.sh
+2 -1
@@ -13,5 +13,6 @@ 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"
16 + # some vintages of macOS 'mv' fails to overwrite a read-only file.
17 + mv -f "$fn.tmp" "$fn"
18 }