summaryrefslogtreecommitdiff
path: root/t/t3100-ls-tree-restrict.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-06-01 01:46:47 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-01 03:32:27 (GMT)
commit66204988fe2e5a2a18c4ff55798c7203775d9fd4 (patch)
treeb44e2c7309c5a90d34b61eb2b19499aebce07f6d /t/t3100-ls-tree-restrict.sh
parent8c7fa2478e16227c8f42d05758bf669b144c5055 (diff)
downloadgit-66204988fe2e5a2a18c4ff55798c7203775d9fd4.zip
git-66204988fe2e5a2a18c4ff55798c7203775d9fd4.tar.gz
git-66204988fe2e5a2a18c4ff55798c7203775d9fd4.tar.bz2
[PATCH] ls-tree: handle trailing slashes in the pathspec properly.
This fixes the problem with ls-tree which failed to show "drivers/char" directory when the user asked for "drivers/char/" from the command line. At the same time, if "drivers/char" were a non directory, "drivers/char/" would not show it. This is consistent with the way diffcore-pathspec has been recently fixed. This adds back the diffcore-pathspec test,dropped when my earlier diffcore-pathspec fix was rejected. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 't/t3100-ls-tree-restrict.sh')
-rw-r--r--t/t3100-ls-tree-restrict.sh39
1 files changed, 34 insertions, 5 deletions
diff --git a/t/t3100-ls-tree-restrict.sh b/t/t3100-ls-tree-restrict.sh
index 02d93eb..61a7c7f 100644
--- a/t/t3100-ls-tree-restrict.sh
+++ b/t/t3100-ls-tree-restrict.sh
@@ -14,7 +14,7 @@ This test runs git-ls-tree with the following in a tree.
path2/baz/b - a file in a directory in a directory
The new path restriction code should do the right thing for path2 and
-path2/baz
+path2/baz. Also path0/ should snow nothing.
'
. ./test-lib.sh
@@ -63,7 +63,7 @@ EOF
test_output'
test_expect_success \
- 'ls-tree filtered' \
+ 'ls-tree filtered with path' \
'git-ls-tree $tree path >current &&
cat >expected <<\EOF &&
EOF
@@ -71,7 +71,7 @@ EOF
test_expect_success \
- 'ls-tree filtered' \
+ 'ls-tree filtered with path1 path0' \
'git-ls-tree $tree path1 path0 >current &&
cat >expected <<\EOF &&
120000 blob X path1
@@ -80,7 +80,14 @@ EOF
test_output'
test_expect_success \
- 'ls-tree filtered' \
+ 'ls-tree filtered with path0/' \
+ 'git-ls-tree $tree path0/ >current &&
+ cat >expected <<\EOF &&
+EOF
+ test_output'
+
+test_expect_success \
+ 'ls-tree filtered with path2' \
'git-ls-tree $tree path2 >current &&
cat >expected <<\EOF &&
040000 tree X path2
@@ -91,7 +98,7 @@ EOF
test_output'
test_expect_success \
- 'ls-tree filtered' \
+ 'ls-tree filtered with path2/baz' \
'git-ls-tree $tree path2/baz >current &&
cat >expected <<\EOF &&
040000 tree X path2/baz
@@ -99,4 +106,26 @@ test_expect_success \
EOF
test_output'
+test_expect_success \
+ 'ls-tree filtered with path2' \
+ 'git-ls-tree $tree path2 >current &&
+ cat >expected <<\EOF &&
+040000 tree X path2
+040000 tree X path2/baz
+120000 blob X path2/bazbo
+100644 blob X path2/foo
+EOF
+ test_output'
+
+test_expect_success \
+ 'ls-tree filtered with path2/' \
+ 'git-ls-tree $tree path2/ >current &&
+ cat >expected <<\EOF &&
+040000 tree X path2
+040000 tree X path2/baz
+120000 blob X path2/bazbo
+100644 blob X path2/foo
+EOF
+ test_output'
+
test_done