mirror of
https://github.com/git/git.git
synced 2024-12-12 03:14:11 +08:00
94221d2203
As of the last commit, we can use "perl" instead of "$PERL_PATH" when running tests, as the former is now a function which uses the latter. As the shorter "perl" is easier on the eyes, let's switch to using it everywhere. This is not quite a mechanical s/$PERL_PATH/perl/ replacement, though. There are some places where we invoke perl from a script we generate on the fly, and those scripts do not have access to our internal shell functions. The result can be double-checked by running: ln -s /bin/false bin-wrappers/perl make test which continues to pass even after this patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
70 lines
1.7 KiB
Bash
Executable File
70 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='git mktree'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
for d in a a. a0
|
|
do
|
|
mkdir "$d" && echo "$d/one" >"$d/one" &&
|
|
git add "$d"
|
|
done &&
|
|
echo zero >one &&
|
|
git update-index --add --info-only one &&
|
|
git write-tree --missing-ok >tree.missing &&
|
|
git ls-tree $(cat tree.missing) >top.missing &&
|
|
git ls-tree -r $(cat tree.missing) >all.missing &&
|
|
echo one >one &&
|
|
git add one &&
|
|
git write-tree >tree &&
|
|
git ls-tree $(cat tree) >top &&
|
|
git ls-tree -r $(cat tree) >all &&
|
|
test_tick &&
|
|
git commit -q -m one &&
|
|
H=$(git rev-parse HEAD) &&
|
|
git update-index --add --cacheinfo 160000 $H sub &&
|
|
test_tick &&
|
|
git commit -q -m two &&
|
|
git rev-parse HEAD^{tree} >tree.withsub &&
|
|
git ls-tree HEAD >top.withsub &&
|
|
git ls-tree -r HEAD >all.withsub
|
|
'
|
|
|
|
test_expect_success 'ls-tree piped to mktree (1)' '
|
|
git mktree <top >actual &&
|
|
test_cmp tree actual
|
|
'
|
|
|
|
test_expect_success 'ls-tree piped to mktree (2)' '
|
|
git mktree <top.withsub >actual &&
|
|
test_cmp tree.withsub actual
|
|
'
|
|
|
|
test_expect_success 'ls-tree output in wrong order given to mktree (1)' '
|
|
perl -e "print reverse <>" <top |
|
|
git mktree >actual &&
|
|
test_cmp tree actual
|
|
'
|
|
|
|
test_expect_success 'ls-tree output in wrong order given to mktree (2)' '
|
|
perl -e "print reverse <>" <top.withsub |
|
|
git mktree >actual &&
|
|
test_cmp tree.withsub actual
|
|
'
|
|
|
|
test_expect_success 'allow missing object with --missing' '
|
|
git mktree --missing <top.missing >actual &&
|
|
test_cmp tree.missing actual
|
|
'
|
|
|
|
test_expect_success 'mktree refuses to read ls-tree -r output (1)' '
|
|
test_must_fail git mktree <all >actual
|
|
'
|
|
|
|
test_expect_success 'mktree refuses to read ls-tree -r output (2)' '
|
|
test_must_fail git mktree <all.withsub >actual
|
|
'
|
|
|
|
test_done
|