Skip to content

Commit 9639e04

Browse files
dschogitster
andcommitted
t0001: handle diff --no-index gracefully
The test case 're-init to move gitdir symlink' wants to compare the contents of `newdir/.git`, which is a symbolic link pointing to a file. However, `git diff --no-index`, which is used by `test_cmp` on Windows, does not resolve symlinks; It shows the symlink _target_ instead (with a file mode of 120000). That is totally unexpected by the test case, which as a consequence fails, meaning that it's a bug in the test case itself. Co-authored-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 96e279f commit 9639e04

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

t/t0001-init.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,11 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
425425
git init --separate-git-dir ../realgitdir
426426
) &&
427427
echo "gitdir: $(pwd)/realgitdir" >expected &&
428-
test_cmp expected newdir/.git &&
428+
case "$GIT_TEST_CMP" in
429+
# `git diff --no-index` does not resolve symlinks
430+
*--no-index*) cmp expected newdir/.git;;
431+
*) test_cmp expected newdir/.git;;
432+
esac &&
429433
test_cmp expected newdir/here &&
430434
test_path_is_dir realgitdir/refs
431435
'

0 commit comments

Comments
 (0)