1#!/bin/sh
2
3test_description='git grep in binary files'
4
5. ./test-lib.sh
6
7test_expect_success 'setup' "
8 printf 'binary\000file\n' >a &&
9 git add a &&
10 git commit -m.
11"
12
13test_expect_success 'git grep ina a' '
14 echo Binary file a matches >expect &&
15 git grep ina a >actual &&
16 test_cmp expect actual
17'
18
19test_expect_success 'git grep -ah ina a' '
20 git grep -ah ina a >actual &&
21 test_cmp a actual
22'
23
24test_expect_success 'git grep -I ina a' '
25 : >expect &&
26 test_must_fail git grep -I ina a >actual &&
27 test_cmp expect actual
28'
29
30test_expect_success 'git grep -c ina a' '
31 echo a:1 >expect &&
32 git grep -c ina a >actual &&
33 test_cmp expect actual
34'
35
36test_expect_success 'git grep -l ina a' '
37 echo a >expect &&
38 git grep -l ina a >actual &&
39 test_cmp expect actual
40'
41
42test_expect_success 'git grep -L bar a' '
43 echo a >expect &&
44 git grep -L bar a >actual &&
45 test_cmp expect actual
46'
47
48test_expect_success 'git grep -q ina a' '
49 : >expect &&
50 git grep -q ina a >actual &&
51 test_cmp expect actual
52'
53
54test_expect_success 'git grep -F ile a' '
55 git grep -F ile a
56'
57
58test_expect_success 'git grep -Fi iLE a' '
59 git grep -Fi iLE a
60'
61
62test_done