]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/lib-chunk: work around broken "mv" on some vintage of macOS
authorJunio C Hamano <gitster@pobox.com>
Thu, 2 May 2024 20:15:57 +0000 (13:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 May 2024 20:16:42 +0000 (13:16 -0700)
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>
t/lib-chunk.sh

index a7cd9c3c6dff6e21eaf4420596809ddb8605730c..9f01df190bb116bd593d8b9ecf94bc4fd4144f38 100644 (file)
@@ -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"
 }