1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-16 22:14:53 +01:00
git/t/t2000-checkout-cache-clash.sh
Stephan Beyer d492b31caf t/: Use "test_must_fail git" instead of "! git"
This patch changes every occurrence of "! git" -- with the meaning
that a git call has to gracefully fail -- into "test_must_fail git".

This is useful to

 - make sure the test does not fail because of a signal,
   e.g. SIGSEGV, and

 - advertise the use of "test_must_fail" for new tests.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 13:21:26 -07:00

51 lines
1.2 KiB
Bash
Executable file

#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#
test_description='git checkout-index test.
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
The git checkout-index command should fail when attempting to checkout
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 \
'git update-index --add various paths.' \
'git update-index --add path0 path1/file1'
rm -fr path0 path1
mkdir path0
date >path0/file0
date >path1
test_expect_success \
'git checkout-index without -f should fail on conflicting work tree.' \
'test_must_fail git checkout-index -a'
test_expect_success \
'git checkout-index with -f should succeed.' \
'git checkout-index -f -a'
test_expect_success \
'git checkout-index conflicting paths.' \
'test -f path0 && test -d path1 && test -f path1/file1'
test_done