]> git.ipfire.org Git - thirdparty/git.git/blob - t/t2002-checkout-cache-u.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t2002-checkout-cache-u.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2005 Junio C Hamano
4 #
5
6 test_description='git checkout-index -u test.
7
8 With -u flag, git checkout-index internally runs the equivalent of
9 git update-index --refresh on the checked out entry.'
10
11 TEST_PASSES_SANITIZE_LEAK=true
12 . ./test-lib.sh
13
14 test_expect_success \
15 'preparation' '
16 echo frotz >path0 &&
17 git update-index --add path0 &&
18 t=$(git write-tree)'
19
20 test_expect_success \
21 'without -u, git checkout-index smudges stat information.' '
22 rm -f path0 &&
23 git read-tree $t &&
24 git checkout-index -f -a &&
25 test_must_fail git diff-files --exit-code'
26
27 test_expect_success \
28 'with -u, git checkout-index picks up stat information from new files.' '
29 rm -f path0 &&
30 git read-tree $t &&
31 git checkout-index -u -f -a &&
32 git diff-files --exit-code'
33
34 test_done