3 # Copyright (c) 2005 Johannes Schindelin
 
   6 test_description='Test diff of symlinks.
 
  10 . "$TEST_DIRECTORY"/diff-lib.sh
 
  13 diff --git a/frotz b/frotz
 
  15 index 0000000..7c465af
 
  20 \ No newline at end of file
 
  23 test_expect_success SYMLINKS \
 
  27     tree=$(git write-tree) &&
 
  28     git update-index --add frotz &&
 
  29     GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree > current &&
 
  30     compare_diff_patch current expected'
 
  32 test_expect_success SYMLINKS \
 
  33     'diff unchanged symlink' \
 
  34     'tree=$(git write-tree) &&
 
  35     git update-index frotz &&
 
  36     test -z "$(git diff-index --name-only $tree)"'
 
  39 diff --git a/frotz b/frotz
 
  40 deleted file mode 120000
 
  41 index 7c465af..0000000
 
  46 \ No newline at end of file
 
  49 test_expect_success SYMLINKS \
 
  50     'diff removed symlink' \
 
  52     git diff-index -M -p $tree > current &&
 
  53     compare_diff_patch current expected'
 
  56 diff --git a/frotz b/frotz
 
  59 test_expect_success SYMLINKS \
 
  60     'diff identical, but newly created symlink' \
 
  62     git diff-index -M -p $tree > current &&
 
  63     compare_diff_patch current expected'
 
  66 diff --git a/frotz b/frotz
 
  67 index 7c465af..df1db54 120000
 
  72 \ No newline at end of file
 
  74 \ No newline at end of file
 
  77 test_expect_success SYMLINKS \
 
  78     'diff different symlink' \
 
  81     git diff-index -M -p $tree > current &&
 
  82     compare_diff_patch current expected'
 
  84 test_expect_success SYMLINKS \
 
  85     'diff symlinks with non-existing targets' \
 
  87     ln -s take\ over brain &&
 
  88     test_must_fail git diff --no-index pinky brain > output 2> output.err &&
 
  90     ! grep error output.err'
 
  92 test_expect_success SYMLINKS 'setup symlinks with attributes' '
 
  93         echo "*.bin diff=bin" >>.gitattributes &&
 
  94         echo content >file.bin &&
 
  95         ln -s file.bin link.bin &&
 
  96         git add -N file.bin link.bin
 
 100 diff --git a/file.bin b/file.bin
 
 101 index e69de29..d95f3ad 100644
 
 102 Binary files a/file.bin and b/file.bin differ
 
 103 diff --git a/link.bin b/link.bin
 
 104 index e69de29..dce41ec 120000
 
 109 \ No newline at end of file
 
 111 test_expect_success SYMLINKS 'symlinks do not respect userdiff config by path' '
 
 112         git config diff.bin.binary true &&
 
 113         git diff file.bin link.bin >actual &&
 
 114         test_cmp expect actual