* [PATCH 11/12] tests for checkout [--full|--path]
@ 2008-07-23 14:57 Nguyễn Thái Ngọc Duy
0 siblings, 0 replies; only message in thread
From: Nguyễn Thái Ngọc Duy @ 2008-07-23 14:57 UTC (permalink / raw)
To: git
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
t/t2010-checkout-sparse.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
create mode 100755 t/t2010-checkout-sparse.sh
diff --git a/t/t2010-checkout-sparse.sh b/t/t2010-checkout-sparse.sh
new file mode 100755
index 0000000..5bb82ae
--- /dev/null
+++ b/t/t2010-checkout-sparse.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+test_description='sparse checkout'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ mkdir work1 work2 work3
+ touch one two three
+ touch work1/one work2/two work3/three
+ git add one work1/one
+ git commit -m work1
+ git add two work2/two
+ git commit -m work2
+ git add three work3/three
+ git commit -m work3
+'
+
+test_expect_success '--full on no-sparse checkout' '
+ git checkout --full
+'
+
+test_expect_success '--full and --path incompatible' '
+ test_must_fail git checkout --full --path=work1
+'
+
+test_expect_success 'limit worktree to work1 and work2' '
+ git checkout --path=work1:work2 &&
+ test work1:work2 = "$(git rev-parse --show-sparse-prefix)" &&
+ test -f work1/one &&
+ test -f work2/two &&
+ ! test -f work3/three
+'
+
+test_expect_success 'update worktree to work2 and work3' '
+ git checkout --path=work2:work3 &&
+ test work2:work3 = "$(git rev-parse --show-sparse-prefix)" &&
+ ! test -f work1/one &&
+ test -f work2/two &&
+ test -f work3/three
+'
+
+test_expect_success 'update sparse prefix with modification' '
+ echo modified >> work2/two &&
+ git checkout --path=work1:work2 &&
+ test work1:work2 = "$(git rev-parse --show-sparse-prefix)" &&
+ test -f work1/one &&
+ test -f work2/two &&
+ ! test -f work3/three &&
+ grep -q modified work2/two
+'
+
+test_expect_success 'update sparse should not lose modification' '
+ ! git checkout --path=work1:work3 &&
+ test work1:work2 = "$(git rev-parse --show-sparse-prefix)" &&
+ test -f work1/one &&
+ test -f work2/two &&
+ ! test -f work3/three &&
+ grep -q modified work2/two
+'
+
+test_expect_success 'exit sparse checkout' '
+ git checkout --full &&
+ test -z "$(git rev-parse --show-sparse-prefix)" &&
+ test -f work1/one &&
+ test -f work2/two &&
+ test -f work3/three &&
+ test one
+'
+
+test_done
--
1.5.5.GIT
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-07-23 14:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23 14:57 [PATCH 11/12] tests for checkout [--full|--path] Nguyễn Thái Ngọc Duy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).