From 861dc19ba852cf668b40d0ef601b44c7c03853a1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 2 May 2024 13:15:57 -0700 Subject: [PATCH] t/lib-chunk: work around broken "mv" on some vintage of macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- t/lib-chunk.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/lib-chunk.sh b/t/lib-chunk.sh index a7cd9c3c6d..9f01df190b 100644 --- a/t/lib-chunk.sh +++ b/t/lib-chunk.sh @@ -13,5 +13,6 @@ corrupt_chunk_file () { fn=$1; shift perl "$TEST_DIRECTORY"/lib-chunk/corrupt-chunk-file.pl \ "$@" <"$fn" >"$fn.tmp" && - mv "$fn.tmp" "$fn" + # some vintages of macOS 'mv' fails to overwrite a read-only file. + mv -f "$fn.tmp" "$fn" }