aboutsummaryrefslogtreecommitdiff
path: root/t/t2000-checkout-cache-clash.sh
diff options
context:
space:
mode:
authorPetr Baudis <pasky@ucw.cz>2005-05-15 01:34:22 +0200
committerPetr Baudis <xpasky@machine.sinus.cz>2005-05-15 01:34:22 +0200
commitf50c9f76ca516051e9f7e7ef68d6a4d0f5830dda (patch)
tree832125b4dc4b9f9a04d6af23839b506f812a7eb2 /t/t2000-checkout-cache-clash.sh
parent986aa7f17e363128856e51efb34c878e0563c509 (diff)
downloadgit-f50c9f76ca516051e9f7e7ef68d6a4d0f5830dda.tar.gz
git-f50c9f76ca516051e9f7e7ef68d6a4d0f5830dda.tar.xz
Rename some test scripts and describe the naming convention
First digit: "family", e.g. the absolute basics and global stuff (0), the basic db-side commands (read-tree, write-tree, commit-tree), the basic working-tree-side commands (checkout-cache, update-cache), the other basic commands (ls-files), the diff commands, the pull commands, exporting commands, revision tree commands... Second digit: the particular command we are testing Third digit: (optionally) the particular switch or group of switches we are testing Freeform part: commandname-details Described in the README. mv t1000-checkout-cache.sh t2000-checkout-cache-clash.sh mv t1001-checkout-cache.sh t2001-checkout-cache-clash.sh mv t0200-update-cache.sh t2010-update-cache-badpath.sh mv t0400-ls-files.sh t3000-ls-files-others.sh mv t0500-ls-files.sh t3010-ls-files-killed.sh
Diffstat (limited to 't/t2000-checkout-cache-clash.sh')
-rwxr-xr-xt/t2000-checkout-cache-clash.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
new file mode 100755
index 000000000..a2c42602d
--- /dev/null
+++ b/t/t2000-checkout-cache-clash.sh
@@ -0,0 +1,53 @@
+#!/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'
+
+test_expect_success \
+ 'git-checkout-cache conflicting paths.' \
+ 'test -f path0 && test -d path1 && test -f path1/file1'
+
+test_done
+
+