]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3102-ls-tree-wildcards.sh
Merge branch 'js/doc-patch-text'
[thirdparty/git.git] / t / t3102-ls-tree-wildcards.sh
CommitLineData
f0096c06
NTND
1#!/bin/sh
2
145f86a0 3test_description='ls-tree with(out) globs'
f0096c06
NTND
4
5. ./test-lib.sh
6
7test_expect_success 'setup' '
145f86a0
JS
8 mkdir a aa "a[a]" &&
9 touch a/one aa/two "a[a]/three" &&
10 git add a/one aa/two "a[a]/three" &&
f0096c06
NTND
11 git commit -m test
12'
13
145f86a0 14test_expect_success 'ls-tree a[a] matches literally' '
378932d3
NTND
15 cat >expect <<-EOF &&
16 100644 blob $EMPTY_BLOB a[a]/three
f1f6224c 17 EOF
145f86a0 18 git ls-tree -r HEAD "a[a]" >actual &&
f1f6224c 19 test_cmp expect actual
f0096c06
NTND
20'
21
1cf9952d 22test_expect_success 'ls-tree outside prefix' '
378932d3
NTND
23 cat >expect <<-EOF &&
24 100644 blob $EMPTY_BLOB ../a[a]/three
f1f6224c 25 EOF
02779185 26 ( cd aa && git ls-tree -r HEAD "../a[a]" ) >actual &&
f1f6224c 27 test_cmp expect actual
1cf9952d
NTND
28'
29
4be4f71f
JH
30test_expect_failure 'ls-tree does not yet support negated pathspec' '
31 git ls-files ":(exclude)a" "a*" >expect &&
32 git ls-tree --name-only -r HEAD ":(exclude)a" "a*" >actual &&
33 test_cmp expect actual
34'
35
f0096c06 36test_done