Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2005 Junio C Hamano |
| 4 | # |
| 5 | |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 6 | test_description='git checkout-index -u test. |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 7 | |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 8 | With -u flag, git checkout-index internally runs the equivalent of |
| 9 | git update-index --refresh on the checked out entry.' |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 10 | |
Ævar Arnfjörð Bjarmason | b7bcdbd | 2021-10-12 15:56:41 +0200 | [diff] [blame] | 11 | TEST_PASSES_SANITIZE_LEAK=true |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 12 | . ./test-lib.sh |
| 13 | |
| 14 | test_expect_success \ |
| 15 | 'preparation' ' |
| 16 | echo frotz >path0 && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 17 | git update-index --add path0 && |
| 18 | t=$(git write-tree)' |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 19 | |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 20 | test_expect_success \ |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 21 | 'without -u, git checkout-index smudges stat information.' ' |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 22 | rm -f path0 && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 23 | git read-tree $t && |
| 24 | git checkout-index -f -a && |
Alex Riesen | 97ad535 | 2008-04-27 13:31:23 +0200 | [diff] [blame] | 25 | test_must_fail git diff-files --exit-code' |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 26 | |
| 27 | test_expect_success \ |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 28 | 'with -u, git checkout-index picks up stat information from new files.' ' |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 29 | rm -f path0 && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 30 | git read-tree $t && |
| 31 | git checkout-index -u -f -a && |
Alex Riesen | 97ad535 | 2008-04-27 13:31:23 +0200 | [diff] [blame] | 32 | git diff-files --exit-code' |
Junio C Hamano | 57fe64a | 2005-05-19 19:00:36 -0700 | [diff] [blame] | 33 | |
| 34 | test_done |