summaryrefslogtreecommitdiff
path: root/t/t1000-checkout-cache.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-14 05:52:42 (GMT)
committerPetr Baudis <xpasky@machine.sinus.cz>2005-05-14 15:41:01 (GMT)
commit368f99d57e8ed17243f2e164431449d48bfca2fb (patch)
treee796629de967435998081b62f62a14de08178965 /t/t1000-checkout-cache.sh
parente1970ce43abfbf625bce68516857e910748e5965 (diff)
downloadgit-368f99d57e8ed17243f2e164431449d48bfca2fb.zip
git-368f99d57e8ed17243f2e164431449d48bfca2fb.tar.gz
git-368f99d57e8ed17243f2e164431449d48bfca2fb.tar.bz2
[PATCH 2/2] The core GIT tests: recent additions and fixes.
This set of scripts are designed to test the features and fixes we recently added to core GIT. The convention to call test helper function has been changed during the framework cleanup (take two), and these tests have been updated to use the cleaned up test-lib.sh interface. Signed-off-by: Junio C Hamano <junkio@cox.net> Note that this does not include the t2000-diff.sh script since it tests a patch which was not applied yet. Signed-off-by: Petr Baudis <pasky@ucw.cz>
Diffstat (limited to 't/t1000-checkout-cache.sh')
-rwxr-xr-xt/t1000-checkout-cache.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/t/t1000-checkout-cache.sh b/t/t1000-checkout-cache.sh
new file mode 100755
index 0000000..c10b6be
--- /dev/null
+++ b/t/t1000-checkout-cache.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+test_description='git-checkout-cache 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-cache 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-cache --add various paths.' \
+ 'git-update-cache --add path0 path1/file1'
+
+rm -fr path0 path1
+mkdir path0
+date >path0/file0
+date >path1
+
+test_expect_failure \
+ 'git-checkout-cache without -f should fail on conflicting work tree.' \
+ 'git-checkout-cache -a'
+
+test_expect_success \
+ 'git-checkout-cache with -f should succeed.' \
+ 'git-checkout-cache -f -a'
+
+if test -f path0 && test -d path1 && test -f path1/file1
+then
+ test_ok "checkout successful"
+else
+ test_failure "checkout failed"
+fi
+
+test_done
+
+