Merge branch 'rs/diff-parseopts-cleanup'
[git/gitster.git] / t / t2102-update-index-symlinks.sh
blobc49cdfb6e582f41ea4010df7f4556f7aad5f1cc4
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes Sixt
6 test_description='git update-index on filesystem w/o symlinks test.
8 This tests that git update-index keeps the symbolic link property
9 even if a plain file is in the working tree if core.symlinks is false.'
11 TEST_PASSES_SANITIZE_LEAK=true
12 . ./test-lib.sh
14 test_expect_success \
15 'preparation' '
16 git config core.symlinks false &&
17 l=$(printf file | git hash-object -t blob -w --stdin) &&
18 echo "120000 $l symlink" | git update-index --index-info'
20 test_expect_success \
21 'modify the symbolic link' '
22 printf new-file > symlink &&
23 git update-index symlink'
25 test_expect_success \
26 'the index entry must still be a symbolic link' '
27 case "$(git ls-files --stage --cached symlink)" in
28 120000" "*symlink) echo pass;;
29 *) echo fail; git ls-files --stage --cached symlink; false;;
30 esac'
32 test_done