* Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-02 6:53 ` Jeff King
@ 2017-01-09 10:51 ` A. Wilcox
2017-01-09 11:27 ` Jeff King
2017-01-09 13:05 ` Andreas Schwab
0 siblings, 2 replies; 12+ messages in thread
From: A. Wilcox @ 2017-01-09 10:51 UTC (permalink / raw)
To: Jeff King; +Cc: git
[-- Attachment #1.1: Type: text/plain, Size: 2146 bytes --]
On 02/01/17 00:53, Jeff King wrote:
> On Sat, Dec 31, 2016 at 10:59:11PM -0600, A. Wilcox wrote:
>
>> I'm attempting to package Git for our new Linux distribution and
>> I have run in to a failure on our PowerPC builder while running
>> the test suite.
>>
>> The PowerPC builder runs a tiny version of grep(1) that was not
>> built with PCRE. As such, grep -P returns 2 and prints:
>>
>> grep: support for the -P option is not compiled into this -
>> --disable-perl-regexp binary
>>
>> However, our Git build *does* link against libpcre. This causes
>> a tests numbered 142 and 143 to fail in t7810-grep.sh.
>
> If we are using "grep -P" in our test suite, it should definitely
> be marked with a prerequisite that is independent of the LIBPCRE
> one.
>
> But I can't find any such place in our test suite. [snip] Can you
> show us the output of "./t7810-grep.sh -v -i"?
>
> -Peff
>
The output of this command was almost 1400 lines, so I attached the log.
Interestingly enough, you seem to be right. The failure is very
bizarre and has nothing to do with system /bin/grep:
test_must_fail: command succeeded: git grep -G -F -P -E a\x{2b}b\x{2a}c ab
not ok 142 - grep -G -F -P -E pattern
#
# >empty &&
# test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c"
ab >actual &&
# test_cmp empty actual
#
However:
elaine trash directory.t7810-grep # git grep -G -F -P -E
a\x{2b}b\x{2a}c ab >actual
fatal: command line, 'ax{2b}bx{2a}c': Invalid contents of {}
elaine trash directory.t7810-grep # echo $?
128
elaine trash directory.t7810-grep # cat actual
elaine trash directory.t7810-grep #
I can reliably reproduce this on our x86_64 builder as well. Note
that our distro is based on the musl libc, not glibc. The shell is:
GNU bash, version 4.3.48(1)-release (powerpc-foxkit-linux-musl)
lrwxrwxrwx 1 root root 4 Dec 29 10:43 /bin/sh -> /bin/bash
Any further assistance would be greatly appreciated; this one really
has me stumped.
Best,
-arw
--
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: test-failure.log --]
[-- Type: text/x-log; name="test-failure.log", Size: 42056 bytes --]
elaine t # ./t7810-grep.sh -v -i
Initialized empty Git repository in /usr/src/dev-vcs/git-2.7.3-r1/work/git-2.7.3/t/trash directory.t7810-grep/.git/
expecting success:
{
echo foo mmap bar
echo foo_mmap bar
echo foo_mmap bar mmap
echo foo mmap bar_mmap
echo foo_mmap bar mmap baz
} >file &&
{
echo Hello world
echo HeLLo world
echo Hello_world
echo HeLLo_world
} >hello_world &&
{
echo "a+b*c"
echo "a+bc"
echo "abc"
} >ab &&
echo vvv >v &&
echo ww w >w &&
echo x x xx x >x &&
echo y yy >y &&
echo zzz > z &&
mkdir t &&
echo test >t/t &&
echo vvv >t/v &&
mkdir t/a &&
echo vvv >t/a/v &&
{
echo "line without leading space1"
echo " line with leading space1"
echo " line with leading space2"
echo " line with leading space3"
echo "line without leading space2"
} >space &&
git add . &&
test_tick &&
git commit -m initial
[master (root-commit) cfd9fd5] initial
Author: A U Thor <author@example.com>
13 files changed, 32 insertions(+)
create mode 100644 ab
create mode 100644 file
create mode 100644 hello.c
create mode 100644 hello_world
create mode 100644 space
create mode 100644 t/a/v
create mode 100644 t/t
create mode 100644 t/v
create mode 100644 v
create mode 100644 w
create mode 100644 x
create mode 100644 y
create mode 100644 z
ok 1 - setup
expecting success:
test_must_fail git grep "("
fatal: unmatched parenthesis
ok 2 - grep should not segfault with a bad input
expecting success:
{
echo ${HC}file:1:foo mmap bar
echo ${HC}file:3:foo_mmap bar mmap
echo ${HC}file:4:foo mmap bar_mmap
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=false grep -n -w -e mmap $H >actual &&
test_cmp expected actual
ok 3 - grep -w HEAD
expecting success:
{
echo ${HC}file:1:foo mmap bar
echo ${HC}file:3:foo_mmap bar mmap
echo ${HC}file:4:foo mmap bar_mmap
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=true grep -w -e mmap $H >actual &&
test_cmp expected actual
ok 4 - grep -w HEAD
expecting success:
{
echo ${HC}file:foo mmap bar
echo ${HC}file:foo_mmap bar mmap
echo ${HC}file:foo mmap bar_mmap
echo ${HC}file:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&
test_cmp expected actual
ok 5 - grep -w HEAD
expecting success:
: >expected &&
test_must_fail git grep -n -w -e "^w" $H >actual &&
test_cmp expected actual
ok 6 - grep -w HEAD (w)
expecting success:
{
echo ${HC}x:1:x x xx x
} >expected &&
git grep -n -w -e "x xx* x" $H >actual &&
test_cmp expected actual
ok 7 - grep -w HEAD (x)
expecting success:
{
echo ${HC}y:1:y yy
} >expected &&
git grep -n -w -e "^y" $H >actual &&
test_cmp expected actual
ok 8 - grep -w HEAD (y-1)
expecting success:
: >expected &&
if git grep -n -w -e "^y y" $H >actual
then
echo should not have matched
cat actual
false
else
test_cmp expected actual
fi
ok 9 - grep -w HEAD (y-2)
expecting success:
: >expected &&
if git grep -n -w -e "^z" $H >actual
then
echo should not have matched
cat actual
false
else
test_cmp expected actual
fi
ok 10 - grep -w HEAD (z)
expecting success:
echo "${HC}t/t:1:test" >expected &&
git grep -n -e test $H >actual &&
test_cmp expected actual
ok 11 - grep HEAD (t-1)
expecting success:
echo "${HC}t:1:test" >expected &&
(
cd t &&
git grep -n -e test $H
) >actual &&
test_cmp expected actual
ok 12 - grep HEAD (t-2)
expecting success:
echo "${HC}t/t:1:test" >expected &&
(
cd t &&
git grep --full-name -n -e test $H
) >actual &&
test_cmp expected actual
ok 13 - grep HEAD (t-3)
expecting success:
! git grep -c test $H | grep /dev/null
ok 14 - grep -c HEAD (no /dev/null)
expecting success:
{
echo ${HC}t/a/v:1:vvv
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth -1 -n -e vvv $H >actual &&
test_cmp expected actual
ok 15 - grep --max-depth -1 HEAD
expecting success:
{
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H >actual &&
test_cmp expected actual
ok 16 - grep --max-depth 0 HEAD
expecting success:
{
echo ${HC}t/a/v:1:vvv
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- "*" >actual &&
test_cmp expected actual
ok 17 - grep --max-depth 0 -- '*' HEAD
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 1 -n -e vvv $H >actual &&
test_cmp expected actual
ok 18 - grep --max-depth 1 HEAD
expecting success:
{
echo ${HC}t/v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t >actual &&
test_cmp expected actual
ok 19 - grep --max-depth 0 -- t HEAD
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
test_cmp expected actual
ok 20 - grep --max-depth 0 -- . t HEAD
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
test_cmp expected actual
ok 21 - grep --max-depth 0 -- t . HEAD
expecting success:
echo "${HC}ab:a+bc" >expected &&
git -c grep.extendedRegexp=false grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 22 - grep HEAD with grep.extendedRegexp=false
expecting success:
echo "${HC}ab:abc" >expected &&
git -c grep.extendedRegexp=true grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 23 - grep HEAD with grep.extendedRegexp=true
expecting success:
echo "${HC}ab:a+bc" >expected &&
git -c grep.patterntype=basic grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 24 - grep HEAD with grep.patterntype=basic
expecting success:
echo "${HC}ab:abc" >expected &&
git -c grep.patterntype=extended grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 25 - grep HEAD with grep.patterntype=extended
expecting success:
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=fixed grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 26 - grep HEAD with grep.patterntype=fixed
expecting success:
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" $H ab >actual &&
test_cmp expected actual
ok 27 - grep HEAD with grep.patterntype=perl
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=default \
-c grep.extendedRegexp=true \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 28 - grep HEAD with grep.patternType=default and grep.extendedRegexp=true
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=default \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 29 - grep HEAD with grep.extendedRegexp=true and grep.patternType=default
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=extended \
-c grep.extendedRegexp=false \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 30 - grep HEAD with grep.patternType=extended and grep.extendedRegexp=false
expecting success:
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.patternType=basic \
-c grep.extendedRegexp=true \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 31 - grep HEAD with grep.patternType=basic and grep.extendedRegexp=true
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=false \
-c grep.patternType=extended \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 32 - grep HEAD with grep.extendedRegexp=false and grep.patternType=extended
expecting success:
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=basic \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 33 - grep HEAD with grep.extendedRegexp=true and grep.patternType=basic
expecting success:
echo ${HC}ab:3 >expected &&
git grep --count -e b $H -- ab >actual &&
test_cmp expected actual
ok 34 - grep --count HEAD
expecting success:
echo 3 >expected &&
git grep --count -h -e b $H -- ab >actual &&
test_cmp expected actual
ok 35 - grep --count -h HEAD
expecting success:
{
echo ${HC}file:1:foo mmap bar
echo ${HC}file:3:foo_mmap bar mmap
echo ${HC}file:4:foo mmap bar_mmap
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=false grep -n -w -e mmap $H >actual &&
test_cmp expected actual
ok 36 - grep -w in working tree
expecting success:
{
echo ${HC}file:1:foo mmap bar
echo ${HC}file:3:foo_mmap bar mmap
echo ${HC}file:4:foo mmap bar_mmap
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=true grep -w -e mmap $H >actual &&
test_cmp expected actual
ok 37 - grep -w in working tree
expecting success:
{
echo ${HC}file:foo mmap bar
echo ${HC}file:foo_mmap bar mmap
echo ${HC}file:foo mmap bar_mmap
echo ${HC}file:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&
test_cmp expected actual
ok 38 - grep -w in working tree
expecting success:
: >expected &&
test_must_fail git grep -n -w -e "^w" $H >actual &&
test_cmp expected actual
ok 39 - grep -w in working tree (w)
expecting success:
{
echo ${HC}x:1:x x xx x
} >expected &&
git grep -n -w -e "x xx* x" $H >actual &&
test_cmp expected actual
ok 40 - grep -w in working tree (x)
expecting success:
{
echo ${HC}y:1:y yy
} >expected &&
git grep -n -w -e "^y" $H >actual &&
test_cmp expected actual
ok 41 - grep -w in working tree (y-1)
expecting success:
: >expected &&
if git grep -n -w -e "^y y" $H >actual
then
echo should not have matched
cat actual
false
else
test_cmp expected actual
fi
ok 42 - grep -w in working tree (y-2)
expecting success:
: >expected &&
if git grep -n -w -e "^z" $H >actual
then
echo should not have matched
cat actual
false
else
test_cmp expected actual
fi
ok 43 - grep -w in working tree (z)
expecting success:
echo "${HC}t/t:1:test" >expected &&
git grep -n -e test $H >actual &&
test_cmp expected actual
ok 44 - grep in working tree (t-1)
expecting success:
echo "${HC}t:1:test" >expected &&
(
cd t &&
git grep -n -e test $H
) >actual &&
test_cmp expected actual
ok 45 - grep in working tree (t-2)
expecting success:
echo "${HC}t/t:1:test" >expected &&
(
cd t &&
git grep --full-name -n -e test $H
) >actual &&
test_cmp expected actual
ok 46 - grep in working tree (t-3)
expecting success:
! git grep -c test $H | grep /dev/null
ok 47 - grep -c in working tree (no /dev/null)
expecting success:
{
echo ${HC}t/a/v:1:vvv
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth -1 -n -e vvv $H >actual &&
test_cmp expected actual
ok 48 - grep --max-depth -1 in working tree
expecting success:
{
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H >actual &&
test_cmp expected actual
ok 49 - grep --max-depth 0 in working tree
expecting success:
{
echo ${HC}t/a/v:1:vvv
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- "*" >actual &&
test_cmp expected actual
ok 50 - grep --max-depth 0 -- '*' in working tree
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 1 -n -e vvv $H >actual &&
test_cmp expected actual
ok 51 - grep --max-depth 1 in working tree
expecting success:
{
echo ${HC}t/v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t >actual &&
test_cmp expected actual
ok 52 - grep --max-depth 0 -- t in working tree
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
test_cmp expected actual
ok 53 - grep --max-depth 0 -- . t in working tree
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
test_cmp expected actual
ok 54 - grep --max-depth 0 -- t . in working tree
expecting success:
echo "${HC}ab:a+bc" >expected &&
git -c grep.extendedRegexp=false grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 55 - grep in working tree with grep.extendedRegexp=false
expecting success:
echo "${HC}ab:abc" >expected &&
git -c grep.extendedRegexp=true grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 56 - grep in working tree with grep.extendedRegexp=true
expecting success:
echo "${HC}ab:a+bc" >expected &&
git -c grep.patterntype=basic grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 57 - grep in working tree with grep.patterntype=basic
expecting success:
echo "${HC}ab:abc" >expected &&
git -c grep.patterntype=extended grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 58 - grep in working tree with grep.patterntype=extended
expecting success:
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=fixed grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 59 - grep in working tree with grep.patterntype=fixed
expecting success:
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" $H ab >actual &&
test_cmp expected actual
ok 60 - grep in working tree with grep.patterntype=perl
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=default \
-c grep.extendedRegexp=true \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 61 - grep in working tree with grep.patternType=default and grep.extendedRegexp=true
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=default \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 62 - grep in working tree with grep.extendedRegexp=true and grep.patternType=default
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=extended \
-c grep.extendedRegexp=false \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 63 - grep in working tree with grep.patternType=extended and grep.extendedRegexp=false
expecting success:
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.patternType=basic \
-c grep.extendedRegexp=true \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 64 - grep in working tree with grep.patternType=basic and grep.extendedRegexp=true
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=false \
-c grep.patternType=extended \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 65 - grep in working tree with grep.extendedRegexp=false and grep.patternType=extended
expecting success:
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=basic \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 66 - grep in working tree with grep.extendedRegexp=true and grep.patternType=basic
expecting success:
echo ${HC}ab:3 >expected &&
git grep --count -e b $H -- ab >actual &&
test_cmp expected actual
ok 67 - grep --count in working tree
expecting success:
echo 3 >expected &&
git grep --count -h -e b $H -- ab >actual &&
test_cmp expected actual
ok 68 - grep --count -h in working tree
expecting success:
git grep -l -C1 foo >actual &&
test_cmp expected actual
ok 69 - grep -l -C
expecting success:
git grep -c -C1 foo >actual &&
test_cmp expected actual
ok 70 - grep -l -C
expecting success:
git ls-files >expected &&
git grep -L -C1 nonexistent_string >actual &&
test_cmp expected actual
ok 71 - grep -L -C
expecting success:
git grep -e "foo mmap" --and -e bar_mmap >actual &&
test_cmp expected actual
ok 72 - grep -e A --and -e B
expecting success:
git grep \( -e foo_ --or -e baz \) \
--and -e " mmap" >actual &&
test_cmp expected actual
ok 73 - grep ( -e A --or -e B ) --and -e B
expecting success:
git grep -e "foo mmap" --and --not -e bar_mmap >actual &&
test_cmp expected actual
ok 74 - grep -e A --and --not -e B
expecting success:
GREP_OPTIONS=-v git grep " mmap bar\$" >actual &&
test_cmp expected actual
ok 75 - grep should ignore GREP_OPTIONS
expecting success:
test_must_fail git grep -f patterns
fatal: cannot open 'patterns': No such file or directory
ok 76 - grep -f, non-existent file
expecting success:
git grep -f pattern >actual &&
test_cmp expected actual
ok 77 - grep -f, one pattern
expecting success:
git grep -f patterns >actual &&
test_cmp expected actual
ok 78 - grep -f, multiple patterns
expecting success:
git grep "$(cat patterns)" >actual &&
test_cmp expected actual
ok 79 - grep, multiple patterns
expecting success:
git grep -f patterns >actual &&
test_cmp expected actual
ok 80 - grep -f, ignore empty lines
expecting success:
git grep -f - <patterns >actual &&
test_cmp expected actual
ok 81 - grep -f, ignore empty lines, read patterns from stdin
expecting success:
>empty &&
git grep -q mmap >actual &&
test_cmp empty actual &&
test_must_fail git grep -q qfwfq >actual &&
test_cmp empty actual
ok 82 - grep -q, silently report matches
expecting success:
git grep -C1 "^[yz]" >actual &&
test_cmp expected actual
ok 83 - grep -C1 hunk mark between files
expecting success:
echo a >>file &&
test_tick &&
GIT_AUTHOR_NAME="With * Asterisk" \
GIT_AUTHOR_EMAIL="xyzzy@frotz.com" \
git commit -a -m "second" &&
echo a >>file &&
test_tick &&
git commit -a -m "third" &&
echo a >>file &&
test_tick &&
GIT_AUTHOR_NAME="Night Fall" \
GIT_AUTHOR_EMAIL="nitfol@frobozz.com" \
git commit -a -m "fourth"
[master b39ecf0] second
Author: With * Asterisk <xyzzy@frotz.com>
1 file changed, 1 insertion(+)
[master 8f9afb5] third
Author: A U Thor <author@example.com>
1 file changed, 1 insertion(+)
[master 2d5652e] fourth
Author: Night Fall <nitfol@frobozz.com>
1 file changed, 1 insertion(+)
ok 84 - log grep setup
expecting success:
git log --author=author --pretty=tformat:%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 85 - log grep (1)
expecting success:
git log --author=" * " -F --pretty=tformat:%s >actual &&
{
echo second
} >expect &&
test_cmp expect actual
ok 86 - log grep (2)
expecting success:
git log --author="^A U" --pretty=tformat:%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 87 - log grep (3)
expecting success:
git log --author="frotz\.com>$" --pretty=tformat:%s >actual &&
{
echo second
} >expect &&
test_cmp expect actual
ok 88 - log grep (4)
expecting success:
git log --author=Thor -F --pretty=tformat:%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 89 - log grep (5)
expecting success:
git log --author=-0700 --pretty=tformat:%s >actual &&
>expect &&
test_cmp expect actual
ok 90 - log grep (6)
expecting success:
git log -g --grep-reflog="commit: third" --pretty=tformat:%s >actual &&
echo third >expect &&
test_cmp expect actual
ok 91 - log grep (7)
expecting success:
git log -g --grep-reflog="commit: third" --grep-reflog="commit: second" --pretty=tformat:%s >actual &&
{
echo third && echo second
} >expect &&
test_cmp expect actual
ok 92 - log grep (8)
expecting success:
git log -g --grep-reflog="commit: third" --author="Thor" --pretty=tformat:%s >actual &&
echo third >expect &&
test_cmp expect actual
ok 93 - log grep (9)
expecting success:
git log -g --grep-reflog="commit: third" --author="non-existant" --pretty=tformat:%s >actual &&
: >expect &&
test_cmp expect actual
ok 94 - log grep (9)
expecting success:
test_must_fail git log --grep-reflog="commit: third"
fatal: cannot use --grep-reflog without --walk-reflogs
ok 95 - log --grep-reflog can only be used under -g
expecting success:
git log --grep=i --grep=r --format=%s >actual &&
{
echo fourth && echo third && echo initial
} >expect &&
test_cmp expect actual
ok 96 - log with multiple --grep uses union
expecting success:
git log --all-match --grep=i --grep=r --format=%s >actual &&
{
echo third
} >expect &&
test_cmp expect actual
ok 97 - log --all-match with multiple --grep uses intersection
expecting success:
git log --author="Thor" --author="Aster" --format=%s >actual &&
{
echo third && echo second && echo initial
} >expect &&
test_cmp expect actual
ok 98 - log with multiple --author uses union
expecting success:
git log --all-match --author="Thor" --author="Aster" --format=%s >actual &&
{
echo third && echo second && echo initial
} >expect &&
test_cmp expect actual
ok 99 - log --all-match with multiple --author still uses union
expecting success:
# grep matches only third and fourth
# author matches only initial and third
git log --author="A U Thor" --grep=r --format=%s >actual &&
{
echo third
} >expect &&
test_cmp expect actual
ok 100 - log --grep --author uses intersection
expecting success:
# grep matches initial and second but not third
# author matches only initial and third
git log --author="A U Thor" --grep=s --grep=l --format=%s >actual &&
{
echo initial
} >expect &&
test_cmp expect actual
ok 101 - log --grep --grep --author takes union of greps and intersects with author
expecting success:
# grep matches only initial and third
# author matches all but second
git log --all-match --author="Thor" --author="Night" --grep=i --format=%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 102 - log ---all-match -grep --author --author still takes union of authors and intersects with grep
expecting success:
# grep matches only initial and third
# author matches all but second
git log --author="Thor" --author="Night" --grep=i --format=%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 103 - log --grep --author --author takes union of authors and intersects with grep
expecting success:
# grep matches only third
# author matches only initial and third
git log --all-match --author="A U Thor" --grep=i --grep=r --format=%s >actual &&
{
echo third
} >expect &&
test_cmp expect actual
ok 104 - log --all-match --grep --grep --author takes intersection
expecting success:
: >expect &&
git log --author="$GIT_AUTHOR_DATE" >actual &&
test_cmp expect actual
ok 105 - log --author does not search in timestamp
expecting success:
: >expect &&
git log --committer="$GIT_COMMITTER_DATE" >actual &&
test_cmp expect actual
ok 106 - log --committer does not search in timestamp
expecting success:
git update-index --assume-unchanged t/t &&
rm t/t &&
test "$(git grep test)" = "t/t:test" &&
git update-index --no-assume-unchanged t/t &&
git checkout t/t
ok 107 - grep with CE_VALID file
expecting success:
git config diff.custom.funcname "^#" &&
echo "hello.c diff=custom" >.gitattributes &&
git grep -p return >actual &&
test_cmp expected actual
ok 108 - grep -p with userdiff
expecting success:
rm -f .gitattributes &&
git grep -p return >actual &&
test_cmp expected actual
ok 109 - grep -p
expecting success:
git grep -p -B5 return >actual &&
test_cmp expected actual
ok 110 - grep -p -B5
expecting success:
git grep -W return >actual &&
test_cmp expected actual
ok 111 - grep -W
expecting success:
test_when_finished "rm -f .gitattributes" &&
git config diff.custom.xfuncname "(printf.*|})$" &&
echo "hello.c diff=custom" >.gitattributes &&
git grep -W return >actual &&
test_cmp expected actual
ok 112 - grep -W with userdiff
expecting success:
mkdir -p s &&
(
cd s && git grep "x x x" ..
)
../x:x x xx x
ok 113 - grep from a subdirectory to search wider area (1)
expecting success:
mkdir -p s &&
(
cd s || exit 1
( git grep xxyyzz .. >out ; echo $? >status )
! test -s out &&
test 1 = $(cat status)
)
ok 114 - grep from a subdirectory to search wider area (2)
expecting success:
git grep -Fi "CHAR *" >actual &&
test_cmp expected actual
ok 115 - grep -Fi
expecting success:
rm -fr non &&
mkdir -p non/git/sub &&
echo hello >non/git/file1 &&
echo world >non/git/sub/file2 &&
{
echo file1:hello &&
echo sub/file2:world
} >non/expect.full &&
echo file2:world >non/expect.sub &&
(
GIT_CEILING_DIRECTORIES="$(pwd)/non/git" &&
export GIT_CEILING_DIRECTORIES &&
cd non/git &&
test_must_fail git grep o &&
git grep --no-index o >../actual.full &&
test_cmp ../expect.full ../actual.full
cd sub &&
test_must_fail git grep o &&
git grep --no-index o >../../actual.sub &&
test_cmp ../../expect.sub ../../actual.sub
) &&
echo ".*o*" >non/git/.gitignore &&
(
GIT_CEILING_DIRECTORIES="$(pwd)/non/git" &&
export GIT_CEILING_DIRECTORIES &&
cd non/git &&
test_must_fail git grep o &&
git grep --no-index --exclude-standard o >../actual.full &&
test_cmp ../expect.full ../actual.full &&
{
echo ".gitignore:.*o*"
cat ../expect.full
} >../expect.with.ignored &&
git grep --no-index --no-exclude o >../actual.full &&
test_cmp ../expect.with.ignored ../actual.full
)
fatal: Not a git repository (or any of the parent directories): .git
ok 116 - outside of git repository
expecting success:
rm -fr is &&
mkdir -p is/git/sub &&
echo hello >is/git/file1 &&
echo world >is/git/sub/file2 &&
echo ".*o*" >is/git/.gitignore &&
{
echo file1:hello &&
echo sub/file2:world
} >is/expect.unignored &&
{
echo ".gitignore:.*o*" &&
cat is/expect.unignored
} >is/expect.full &&
: >is/expect.empty &&
echo file2:world >is/expect.sub &&
(
cd is/git &&
git init &&
test_must_fail git grep o >../actual.full &&
test_cmp ../expect.empty ../actual.full &&
git grep --untracked o >../actual.unignored &&
test_cmp ../expect.unignored ../actual.unignored &&
git grep --no-index o >../actual.full &&
test_cmp ../expect.full ../actual.full &&
git grep --no-index --exclude-standard o >../actual.unignored &&
test_cmp ../expect.unignored ../actual.unignored &&
cd sub &&
test_must_fail git grep o >../../actual.sub &&
test_cmp ../../expect.empty ../../actual.sub &&
git grep --no-index o >../../actual.sub &&
test_cmp ../../expect.sub ../../actual.sub &&
git grep --untracked o >../../actual.sub &&
test_cmp ../../expect.sub ../../actual.sub
)
Initialized empty Git repository in /usr/src/dev-vcs/git-2.7.3-r1/work/git-2.7.3/t/trash directory.t7810-grep/is/git/.git/
ok 117 - inside git repository but with --no-index
expecting success:
cat >double-dash <<EOF &&
--
->
other
EOF
git add double-dash
ok 118 - setup double-dash tests
expecting success:
git grep -- "->" >actual &&
test_cmp expected actual
ok 119 - grep -- pattern
expecting success:
git grep -- "->" -- double-dash >actual &&
test_cmp expected actual
ok 120 - grep -- pattern -- pathspec
expecting success:
git grep -e "->" -- double-dash >actual &&
test_cmp expected actual
ok 121 - grep -e pattern -- path
expecting success:
git grep -e -- -- double-dash >actual &&
test_cmp expected actual
ok 122 - grep -e -- -- path
expecting success:
git grep --perl-regexp "\p{Ps}.*?\p{Pe}" hello.c >actual &&
test_cmp expected actual
ok 123 - grep --perl-regexp pattern
expecting success:
git grep -P "\p{Ps}.*?\p{Pe}" hello.c >actual &&
test_cmp expected actual
ok 124 - grep -P pattern
expecting success:
>empty &&
test_must_fail git -c grep.extendedregexp=true \
grep "\p{Ps}.*?\p{Pe}" hello.c >actual &&
test_cmp empty actual
fatal: command line, '\p{Ps}.*?\p{Pe}': Invalid contents of {}
ok 125 - grep pattern with grep.extendedRegexp=true
expecting success:
git -c grep.extendedregexp=true \
grep -P "\p{Ps}.*?\p{Pe}" hello.c >actual &&
test_cmp expected actual
ok 126 - grep -P pattern with grep.extendedRegexp=true
expecting success:
{
echo "ab:a+b*c"
echo "ab:a+bc"
} >expected &&
git grep -P -v "abc" ab >actual &&
test_cmp expected actual
ok 127 - grep -P -v pattern
expecting success:
cat >expected <<-EOF &&
hello.c: printf("Hello world.\n");
EOF
git grep -P -i "PRINTF\([^\d]+\)" hello.c >actual &&
test_cmp expected actual
ok 128 - grep -P -i pattern
expecting success:
{
echo "hello_world:Hello world"
echo "hello_world:HeLLo world"
} >expected &&
git grep -P -w "He((?i)ll)o" hello_world >actual &&
test_cmp expected actual
ok 129 - grep -P -w pattern
expecting success:
test_must_fail git grep -G "a["
fatal: command line, 'a[': Missing ']'
ok 130 - grep -G invalidpattern properly dies
expecting success:
test_must_fail git -c grep.patterntype=basic grep "a["
fatal: command line, 'a[': Missing ']'
ok 131 - grep invalidpattern properly dies with grep.patternType=basic
expecting success:
test_must_fail git grep -E "a["
fatal: command line, 'a[': Missing ']'
ok 132 - grep -E invalidpattern properly dies
expecting success:
test_must_fail git -c grep.patterntype=extended grep "a["
fatal: command line, 'a[': Missing ']'
ok 133 - grep invalidpattern properly dies with grep.patternType=extended
expecting success:
test_must_fail git grep -P "a["
fatal: command line, 'a[': missing terminating ] for character class
ok 134 - grep -P invalidpattern properly dies
expecting success:
test_must_fail git -c grep.patterntype=perl grep "a["
fatal: command line, 'a[': missing terminating ] for character class
ok 135 - grep invalidpattern properly dies with grep.patternType=perl
expecting success:
echo "ab:a+b*c" >expected &&
git grep -G -E -F "a+b*c" ab >actual &&
test_cmp expected actual
ok 136 - grep -G -E -F pattern
expecting success:
echo "ab:a+b*c" >expected &&
git \
-c grep.patterntype=basic \
-c grep.patterntype=extended \
-c grep.patterntype=fixed \
grep "a+b*c" ab >actual &&
test_cmp expected actual
ok 137 - grep pattern with grep.patternType=basic, =extended, =fixed
expecting success:
echo "ab:a+bc" >expected &&
git grep -E -F -G "a+b*c" ab >actual &&
test_cmp expected actual
ok 138 - grep -E -F -G pattern
expecting success:
echo "ab:a+bc" >expected &&
git \
-c grep.patterntype=extended \
-c grep.patterntype=fixed \
-c grep.patterntype=basic \
grep "a+b*c" ab >actual &&
test_cmp expected actual
ok 139 - grep pattern with grep.patternType=extended, =fixed, =basic
expecting success:
echo "ab:abc" >expected &&
git grep -F -G -E "a+b*c" ab >actual &&
test_cmp expected actual
ok 140 - grep -F -G -E pattern
expecting success:
echo "ab:abc" >expected &&
git \
-c grep.patterntype=fixed \
-c grep.patterntype=basic \
-c grep.patterntype=extended \
grep "a+b*c" ab >actual &&
test_cmp expected actual
ok 141 - grep pattern with grep.patternType=fixed, =basic, =extended
expecting success:
>empty &&
test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c" ab >actual &&
test_cmp empty actual
test_must_fail: command succeeded: git grep -G -F -P -E a\x{2b}b\x{2a}c ab
not ok 142 - grep -G -F -P -E pattern
#
# >empty &&
# test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c" ab >actual &&
# test_cmp empty actual
#
elaine t # elaine t # cd trash\ directory.t7810-grep/
elaine trash directory.t7810-grep # git grep -G -F -P -E a\x{2b}b\x{2a}c ab >actual
fatal: command line, 'ax{2b}bx{2a}c': Invalid contents of {}
elaine trash directory.t7810-grep # echo $?
128
elaine trash directory.t7810-grep # cat actual
elaine trash directory.t7810-grep # rm actual
elaine trash directory.t7810-grep #
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread