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 checkout-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 checkout-index creates a symbolic link as a plain |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 9 | file if core.symlinks is false.' |
| 10 | |
Ævar Arnfjörð Bjarmason | b7bcdbd | 2021-10-12 15:56:41 +0200 | [diff] [blame] | 11 | TEST_PASSES_SANITIZE_LEAK=true |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 12 | . ./test-lib.sh |
| 13 | |
| 14 | test_expect_success \ |
| 15 | 'preparation' ' |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 16 | git config core.symlinks false && |
Brian Gernhardt | 6ecfd91 | 2008-10-31 01:09:13 -0400 | [diff] [blame] | 17 | l=$(printf file | git hash-object -t blob -w --stdin) && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 18 | echo "120000 $l symlink" | git update-index --index-info' |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 19 | |
| 20 | test_expect_success \ |
| 21 | 'the checked-out symlink must be a file' ' |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 22 | git checkout-index symlink && |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 23 | test -f symlink' |
| 24 | |
Ævar Arnfjörð Bjarmason | 4bd0785 | 2023-02-06 23:44:31 +0100 | [diff] [blame] | 25 | test_expect_success 'the file must be the blob we added during the setup' ' |
| 26 | echo "$l" >expect && |
| 27 | git hash-object -t blob symlink >actual && |
| 28 | test_cmp expect actual |
| 29 | ' |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 30 | |
| 31 | test_done |