2007-03-02 21:11:30 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2007 Johannes Sixt
|
|
|
|
#
|
|
|
|
|
2007-07-03 05:52:14 +00:00
|
|
|
test_description='git update-index on filesystem w/o symlinks test.
|
2007-03-02 21:11:30 +00:00
|
|
|
|
2007-07-03 05:52:14 +00:00
|
|
|
This tests that git update-index keeps the symbolic link property
|
2007-03-02 21:11:30 +00:00
|
|
|
even if a plain file is in the working tree if core.symlinks is false.'
|
|
|
|
|
2021-10-30 22:24:16 +00:00
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2007-03-02 21:11:30 +00:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'preparation' '
|
2007-07-03 05:52:14 +00:00
|
|
|
git config core.symlinks false &&
|
2008-10-31 05:09:13 +00:00
|
|
|
l=$(printf file | git hash-object -t blob -w --stdin) &&
|
2007-07-03 05:52:14 +00:00
|
|
|
echo "120000 $l symlink" | git update-index --index-info'
|
2007-03-02 21:11:30 +00:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'modify the symbolic link' '
|
2008-10-31 05:09:13 +00:00
|
|
|
printf new-file > symlink &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git update-index symlink'
|
2007-03-02 21:11:30 +00:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'the index entry must still be a symbolic link' '
|
2015-12-22 15:05:53 +00:00
|
|
|
case "$(git ls-files --stage --cached symlink)" in
|
2010-06-24 17:44:49 +00:00
|
|
|
120000" "*symlink) echo pass;;
|
2021-12-09 05:11:09 +00:00
|
|
|
*) echo fail; git ls-files --stage --cached symlink; false;;
|
2007-03-02 21:11:30 +00:00
|
|
|
esac'
|
|
|
|
|
|
|
|
test_done
|