Skip to content

Commit dbb27bd

Browse files
committed
t5605: special-case hardlink test for BusyBox-w32
When t5605 tries to verify that files are hardlinked (or that they are not), it uses the `-links` option of the `find` utility. BusyBox' implementation does not support that option, and BusyBox-w32's lstat() does not even report the number of hard links correctly (for performance reasons). So let's just switch to a different method that actually works on Windows. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent ffe9503 commit dbb27bd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

t/t5605-clone-local.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ repo_is_hardlinked() {
1212
test_line_count = 0 output
1313
}
1414

15+
if test_have_prereq MINGW,BUSYBOX
16+
then
17+
# BusyBox' `find` does not support `-links`. Besides, BusyBox-w32's
18+
# lstat() does not report hard links, just like Git's mingw_lstat()
19+
# (from where BusyBox-w32 got its initial implementation).
20+
repo_is_hardlinked() {
21+
for f in $(find "$1/objects" -type f)
22+
do
23+
"$SYSTEMROOT"/system32/fsutil.exe \
24+
hardlink list $f >links &&
25+
test_line_count -gt 1 links || return 1
26+
done
27+
}
28+
fi
29+
1530
test_expect_success 'preparing origin repository' '
1631
: >file && git add . && git commit -m1 &&
1732
git clone --bare . a.git &&

0 commit comments

Comments
 (0)