2005-05-14 13:52:42 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
|
|
#
|
|
|
|
|
2007-07-03 13:52:14 +08:00
|
|
|
test_description='git checkout-index test.
|
2005-05-14 13:52:42 +08:00
|
|
|
|
|
|
|
This test registers the following filesystem structure in the
|
|
|
|
cache:
|
|
|
|
|
|
|
|
path0 - a file
|
|
|
|
path1/file1 - a file in a directory
|
|
|
|
|
|
|
|
And then tries to checkout in a work tree that has the following:
|
|
|
|
|
|
|
|
path0/file0 - a file in a directory
|
|
|
|
path1 - a file
|
|
|
|
|
2007-07-03 13:52:14 +08:00
|
|
|
The git checkout-index command should fail when attempting to checkout
|
2005-05-14 13:52:42 +08:00
|
|
|
path0, finding it is occupied by a directory, and path1/file1, finding
|
|
|
|
path1 is occupied by a non-directory. With "-f" flag, it should remove
|
|
|
|
the conflicting paths and succeed.
|
|
|
|
'
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
date >path0
|
|
|
|
mkdir path1
|
|
|
|
date >path1/file1
|
|
|
|
|
|
|
|
test_expect_success \
|
2007-07-03 13:52:14 +08:00
|
|
|
'git update-index --add various paths.' \
|
|
|
|
'git update-index --add path0 path1/file1'
|
2005-05-14 13:52:42 +08:00
|
|
|
|
|
|
|
rm -fr path0 path1
|
|
|
|
mkdir path0
|
|
|
|
date >path0/file0
|
|
|
|
date >path1
|
|
|
|
|
2008-02-01 17:50:53 +08:00
|
|
|
test_expect_success \
|
2007-07-03 13:52:14 +08:00
|
|
|
'git checkout-index without -f should fail on conflicting work tree.' \
|
2008-02-01 17:50:53 +08:00
|
|
|
'! git checkout-index -a'
|
2005-05-14 13:52:42 +08:00
|
|
|
|
|
|
|
test_expect_success \
|
2007-07-03 13:52:14 +08:00
|
|
|
'git checkout-index with -f should succeed.' \
|
|
|
|
'git checkout-index -f -a'
|
2005-05-14 13:52:42 +08:00
|
|
|
|
2005-05-14 15:24:27 +08:00
|
|
|
test_expect_success \
|
2007-07-03 13:52:14 +08:00
|
|
|
'git checkout-index conflicting paths.' \
|
2005-05-14 15:24:27 +08:00
|
|
|
'test -f path0 && test -d path1 && test -f path1/file1'
|
2005-05-14 13:52:42 +08:00
|
|
|
|
|
|
|
test_done
|