Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2007 Johannes Sixt |
| 4 | # |
| 5 | |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 6 | test_description='git update-index on filesystem w/o symlinks test. |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 7 | |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 8 | This tests that git update-index keeps the symbolic link property |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 9 | even if a plain file is in the working tree if core.symlinks is false.' |
| 10 | |
| 11 | . ./test-lib.sh |
| 12 | |
| 13 | test_expect_success \ |
| 14 | 'preparation' ' |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 15 | git config core.symlinks false && |
Brian Gernhardt | 6ecfd91 | 2008-10-31 01:09:13 -0400 | [diff] [blame] | 16 | l=$(printf file | git hash-object -t blob -w --stdin) && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 17 | echo "120000 $l symlink" | git update-index --index-info' |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 18 | |
| 19 | test_expect_success \ |
| 20 | 'modify the symbolic link' ' |
Brian Gernhardt | 6ecfd91 | 2008-10-31 01:09:13 -0400 | [diff] [blame] | 21 | printf new-file > symlink && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 22 | git update-index symlink' |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 23 | |
| 24 | test_expect_success \ |
| 25 | 'the index entry must still be a symbolic link' ' |
Elia Pinto | fc12fa3 | 2015-12-22 16:05:53 +0100 | [diff] [blame] | 26 | case "$(git ls-files --stage --cached symlink)" in |
Ævar Arnfjörð Bjarmason | 335f878 | 2010-06-24 17:44:49 +0000 | [diff] [blame] | 27 | 120000" "*symlink) echo pass;; |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 28 | *) echo fail; git ls-files --stage --cached symlink; (exit 1);; |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 29 | esac' |
| 30 | |
| 31 | test_done |