tvl-depot/third_party/git/t/t3005-ls-files-relative.sh
Vincent Ambo f4609b896f merge(3p/git): Merge git subtree at v2.29.2
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because
there is some breakage in the git build related to the netrc
credentials helper which someone has taken care of in nixpkgs.

The stable channel is not used for anything other than git, so this
should be fine.

Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
2020-11-21 19:45:56 +01:00

68 lines
1.4 KiB
Bash
Executable file

#!/bin/sh
test_description='ls-files tests with relative paths
This test runs git ls-files with various relative path arguments.
'
. ./test-lib.sh
test_expect_success 'prepare' '
: >never-mind-me &&
git add never-mind-me &&
mkdir top &&
(
cd top &&
mkdir sub &&
x="x xa xbc xdef xghij xklmno" &&
y=$(echo "$x" | tr x y) &&
touch $x &&
touch $y &&
cd sub &&
git add ../x*
)
'
test_expect_success 'ls-files with mixed levels' '
(
cd top/sub &&
cat >expect <<-EOF &&
../../never-mind-me
../x
EOF
git ls-files $(cat expect) >actual &&
test_cmp expect actual
)
'
test_expect_success 'ls-files -c' '
(
cd top/sub &&
for f in ../y*
do
echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git"
done >expect.err &&
echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err &&
ls ../x* >expect.out &&
test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err &&
test_cmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
)
'
test_expect_success 'ls-files -o' '
(
cd top/sub &&
for f in ../x*
do
echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git"
done >expect.err &&
echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err &&
ls ../y* >expect.out &&
test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err &&
test_cmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
)
'
test_done