Skip to content

Commit 861dc19

Browse files
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 564d025 commit 861dc19

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/lib-chunk.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ corrupt_chunk_file () {
1313
fn=$1; shift
1414
perl "$TEST_DIRECTORY"/lib-chunk/corrupt-chunk-file.pl \
1515
"$@" <"$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"
1718
}

0 commit comments

Comments
 (0)