2011-03-25 17:34:19 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-05-12 16:37:22 +08:00
|
|
|
test_description='ls-tree with(out) globs'
|
2011-03-25 17:34:19 +08:00
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success 'setup' '
|
2011-05-12 16:37:22 +08:00
|
|
|
mkdir a aa "a[a]" &&
|
|
|
|
touch a/one aa/two "a[a]/three" &&
|
|
|
|
git add a/one aa/two "a[a]/three" &&
|
2011-03-25 17:34:19 +08:00
|
|
|
git commit -m test
|
|
|
|
'
|
|
|
|
|
2011-05-12 16:37:22 +08:00
|
|
|
test_expect_success 'ls-tree a[a] matches literally' '
|
2016-07-16 13:06:25 +08:00
|
|
|
cat >expect <<-EOF &&
|
|
|
|
100644 blob $EMPTY_BLOB a[a]/three
|
2014-12-02 03:45:57 +08:00
|
|
|
EOF
|
2011-05-12 16:37:22 +08:00
|
|
|
git ls-tree -r HEAD "a[a]" >actual &&
|
2014-12-02 03:45:57 +08:00
|
|
|
test_cmp expect actual
|
2011-03-25 17:34:19 +08:00
|
|
|
'
|
|
|
|
|
2014-11-30 17:05:01 +08:00
|
|
|
test_expect_success 'ls-tree outside prefix' '
|
2016-07-16 13:06:25 +08:00
|
|
|
cat >expect <<-EOF &&
|
|
|
|
100644 blob $EMPTY_BLOB ../a[a]/three
|
2014-12-02 03:45:57 +08:00
|
|
|
EOF
|
2014-11-30 17:05:01 +08:00
|
|
|
( cd aa && git ls-tree -r HEAD "../a[a]"; ) >actual &&
|
2014-12-02 03:45:57 +08:00
|
|
|
test_cmp expect actual
|
2014-11-30 17:05:01 +08:00
|
|
|
'
|
|
|
|
|
2014-12-02 03:48:34 +08:00
|
|
|
test_expect_failure 'ls-tree does not yet support negated pathspec' '
|
|
|
|
git ls-files ":(exclude)a" "a*" >expect &&
|
|
|
|
git ls-tree --name-only -r HEAD ":(exclude)a" "a*" >actual &&
|
|
|
|
test_cmp expect actual
|
|
|
|
'
|
|
|
|
|
2011-03-25 17:34:19 +08:00
|
|
|
test_done
|