3 # Copyright (c) 2005 Johannes Schindelin
6 test_description
='Test diff of symlinks.
10 .
"$TEST_DIRECTORY"/diff-lib.sh
12 if ! test_have_prereq SYMLINKS
14 skip_all
='Symbolic links not supported, skipping tests.'
19 diff --git a/frotz b/frotz
21 index 0000000..7c465af
26 \ No newline at end of file
33 tree=$(git write-tree) &&
34 git update-index --add frotz &&
35 GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree > current &&
36 compare_diff_patch current expected'
39 'diff unchanged symlink' \
40 'tree=$(git write-tree) &&
41 git update-index frotz &&
42 test -z "$(git diff-index --name-only $tree)"'
45 diff --git a/frotz b/frotz
46 deleted file mode 120000
47 index 7c465af..0000000
52 \ No newline at end of file
56 'diff removed symlink' \
58 git diff-index -M -p $tree > current &&
59 compare_diff_patch current expected'
62 diff --git a/frotz b/frotz
66 'diff identical, but newly created symlink' \
68 git diff-index -M -p $tree > current &&
69 compare_diff_patch current expected'
72 diff --git a/frotz b/frotz
73 index 7c465af..df1db54 120000
78 \ No newline at end of file
80 \ No newline at end of file
84 'diff different symlink' \
87 git diff-index -M -p $tree > current &&
88 compare_diff_patch current expected'
91 'diff symlinks with non-existing targets' \
93 ln -s take\ over brain &&
94 test_must_fail git diff --no-index pinky brain > output 2> output.err &&
96 ! grep error output.err'
98 test_expect_success SYMLINKS
'setup symlinks with attributes' '
99 echo "*.bin diff=bin" >>.gitattributes &&
100 echo content >file.bin &&
101 ln -s file.bin link.bin &&
102 git add -N file.bin link.bin
106 diff --git a/file.bin b/file.bin
107 index e69de29..d95f3ad 100644
108 Binary files a/file.bin and b/file.bin differ
109 diff --git a/link.bin b/link.bin
110 index e69de29..dce41ec 120000
115 \ No newline at end of file
117 test_expect_success SYMLINKS
'symlinks do not respect userdiff config by path' '
118 git config diff.bin.binary true &&
119 git diff file.bin link.bin >actual &&
120 test_cmp expect actual