summaryrefslogtreecommitdiffstats
path: root/t/t3002-ls-files-dashpath.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:49:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:49:36 +0000
commit5ec6074f0633939fd17d94111d10c6c6b062978c (patch)
treebfaa17b5a64abc66c918e9c70969e519d9e1df8e /t/t3002-ls-files-dashpath.sh
parentInitial commit. (diff)
downloadgit-5ec6074f0633939fd17d94111d10c6c6b062978c.tar.xz
git-5ec6074f0633939fd17d94111d10c6c6b062978c.zip
Adding upstream version 1:2.30.2.upstream/1%2.30.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/t3002-ls-files-dashpath.sh')
-rwxr-xr-xt/t3002-ls-files-dashpath.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/t/t3002-ls-files-dashpath.sh b/t/t3002-ls-files-dashpath.sh
new file mode 100755
index 0000000..8704b04
--- /dev/null
+++ b/t/t3002-ls-files-dashpath.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+test_description='git ls-files test (-- to terminate the path list).
+
+This test runs git ls-files --others with the following on the
+filesystem.
+
+ path0 - a file
+ -foo - a file with a funny name.
+ -- - another file with a funny name.
+'
+. ./test-lib.sh
+
+test_expect_success \
+ setup \
+ 'echo frotz >path0 &&
+ echo frotz >./-foo &&
+ echo frotz >./--'
+
+test_expect_success \
+ 'git ls-files without path restriction.' \
+ 'git ls-files --others >output &&
+ test_cmp output - <<EOF
+--
+-foo
+output
+path0
+EOF
+'
+
+test_expect_success \
+ 'git ls-files with path restriction.' \
+ 'git ls-files --others path0 >output &&
+ test_cmp output - <<EOF
+path0
+EOF
+'
+
+test_expect_success \
+ 'git ls-files with path restriction with --.' \
+ 'git ls-files --others -- path0 >output &&
+ test_cmp output - <<EOF
+path0
+EOF
+'
+
+test_expect_success \
+ 'git ls-files with path restriction with -- --.' \
+ 'git ls-files --others -- -- >output &&
+ test_cmp output - <<EOF
+--
+EOF
+'
+
+test_expect_success \
+ 'git ls-files with no path restriction.' \
+ 'git ls-files --others -- >output &&
+ test_cmp output - <<EOF
+--
+-foo
+output
+path0
+EOF
+'
+
+test_done