2005-05-15 23:23:12 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
|
|
#
|
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
test_description='git checkout-index -u test.
|
2005-05-15 23:23:12 +02:00
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
With -u flag, git checkout-index internally runs the equivalent of
|
|
|
|
git update-index --refresh on the checked out entry.'
|
2005-05-15 23:23:12 +02:00
|
|
|
|
2021-10-12 15:56:41 +02:00
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2005-05-15 23:23:12 +02:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'preparation' '
|
|
|
|
echo frotz >path0 &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git update-index --add path0 &&
|
|
|
|
t=$(git write-tree)'
|
2005-05-15 23:23:12 +02:00
|
|
|
|
2008-02-01 10:50:53 +01:00
|
|
|
test_expect_success \
|
2007-07-03 07:52:14 +02:00
|
|
|
'without -u, git checkout-index smudges stat information.' '
|
2005-05-15 23:23:12 +02:00
|
|
|
rm -f path0 &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git read-tree $t &&
|
|
|
|
git checkout-index -f -a &&
|
2008-04-27 13:31:23 +02:00
|
|
|
test_must_fail git diff-files --exit-code'
|
2005-05-15 23:23:12 +02:00
|
|
|
|
|
|
|
test_expect_success \
|
2007-07-03 07:52:14 +02:00
|
|
|
'with -u, git checkout-index picks up stat information from new files.' '
|
2005-05-15 23:23:12 +02:00
|
|
|
rm -f path0 &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git read-tree $t &&
|
|
|
|
git checkout-index -u -f -a &&
|
2008-04-27 13:31:23 +02:00
|
|
|
git diff-files --exit-code'
|
2005-05-20 04:00:36 +02:00
|
|
|
|
|
|
|
test_done
|