t0027: check the eol conversion warnings
[gitweb.git] / t / t7810-grep.sh
index e3eeaf988a932367a10c5e030c5d1cee4af8dcb9..028ffe4a05c066c112655822a351b64ed80f9c99 100755 (executable)
@@ -105,7 +105,7 @@ do
 
        test_expect_success "grep -w $L (w)" '
                : >expected &&
-               test_must_fail git grep -n -w -e "^w" >actual &&
+               test_must_fail git grep -n -w -e "^w" $H >actual &&
                test_cmp expected actual
        '
 
@@ -240,92 +240,104 @@ do
                test_cmp expected actual
        '
        test_expect_success "grep $L with grep.extendedRegexp=false" '
-               echo "ab:a+bc" >expected &&
-               git -c grep.extendedRegexp=false grep "a+b*c" ab >actual &&
+               echo "${HC}ab:a+bc" >expected &&
+               git -c grep.extendedRegexp=false grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
        test_expect_success "grep $L with grep.extendedRegexp=true" '
-               echo "ab:abc" >expected &&
-               git -c grep.extendedRegexp=true grep "a+b*c" ab >actual &&
+               echo "${HC}ab:abc" >expected &&
+               git -c grep.extendedRegexp=true grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
        test_expect_success "grep $L with grep.patterntype=basic" '
-               echo "ab:a+bc" >expected &&
-               git -c grep.patterntype=basic grep "a+b*c" ab >actual &&
+               echo "${HC}ab:a+bc" >expected &&
+               git -c grep.patterntype=basic grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
        test_expect_success "grep $L with grep.patterntype=extended" '
-               echo "ab:abc" >expected &&
-               git -c grep.patterntype=extended grep "a+b*c" ab >actual &&
+               echo "${HC}ab:abc" >expected &&
+               git -c grep.patterntype=extended grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
        test_expect_success "grep $L with grep.patterntype=fixed" '
-               echo "ab:a+b*c" >expected &&
-               git -c grep.patterntype=fixed grep "a+b*c" ab >actual &&
+               echo "${HC}ab:a+b*c" >expected &&
+               git -c grep.patterntype=fixed grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
        test_expect_success LIBPCRE "grep $L with grep.patterntype=perl" '
-               echo "ab:a+b*c" >expected &&
-               git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" ab >actual &&
+               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
        '
 
        test_expect_success "grep $L with grep.patternType=default and grep.extendedRegexp=true" '
-               echo "ab:abc" >expected &&
+               echo "${HC}ab:abc" >expected &&
                git \
                        -c grep.patternType=default \
                        -c grep.extendedRegexp=true \
-                       grep "a+b*c" ab >actual &&
+                       grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
        test_expect_success "grep $L with grep.extendedRegexp=true and grep.patternType=default" '
-               echo "ab:abc" >expected &&
+               echo "${HC}ab:abc" >expected &&
                git \
                        -c grep.extendedRegexp=true \
                        -c grep.patternType=default \
-                       grep "a+b*c" ab >actual &&
+                       grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
-       test_expect_success 'grep $L with grep.patternType=extended and grep.extendedRegexp=false' '
-               echo "ab:abc" >expected &&
+       test_expect_success "grep $L with grep.patternType=extended and grep.extendedRegexp=false" '
+               echo "${HC}ab:abc" >expected &&
                git \
                        -c grep.patternType=extended \
                        -c grep.extendedRegexp=false \
-                       grep "a+b*c" ab >actual &&
+                       grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
-       test_expect_success 'grep $L with grep.patternType=basic and grep.extendedRegexp=true' '
-               echo "ab:a+bc" >expected &&
+       test_expect_success "grep $L with grep.patternType=basic and grep.extendedRegexp=true" '
+               echo "${HC}ab:a+bc" >expected &&
                git \
                        -c grep.patternType=basic \
                        -c grep.extendedRegexp=true \
-                       grep "a+b*c" ab >actual &&
+                       grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
-       test_expect_success 'grep $L with grep.extendedRegexp=false and grep.patternType=extended' '
-               echo "ab:abc" >expected &&
+       test_expect_success "grep $L with grep.extendedRegexp=false and grep.patternType=extended" '
+               echo "${HC}ab:abc" >expected &&
                git \
                        -c grep.extendedRegexp=false \
                        -c grep.patternType=extended \
-                       grep "a+b*c" ab >actual &&
+                       grep "a+b*c" $H ab >actual &&
                test_cmp expected actual
        '
 
-       test_expect_success 'grep $L with grep.extendedRegexp=true and grep.patternType=basic' '
-               echo "ab:a+bc" >expected &&
+       test_expect_success "grep $L with grep.extendedRegexp=true and grep.patternType=basic" '
+               echo "${HC}ab:a+bc" >expected &&
                git \
                        -c grep.extendedRegexp=true \
                        -c grep.patternType=basic \
-                       grep "a+b*c" ab >actual &&
+                       grep "a+b*c" $H ab >actual &&
+               test_cmp expected actual
+       '
+
+       test_expect_success "grep --count $L" '
+               echo ${HC}ab:3 >expected &&
+               git grep --count -e b $H -- ab >actual &&
+               test_cmp expected actual
+       '
+
+       test_expect_success "grep --count -h $L" '
+               echo 3 >expected &&
+               git grep --count -h -e b $H -- ab >actual &&
                test_cmp expected actual
        '
 done
@@ -1084,11 +1096,6 @@ test_expect_success 'grep -E pattern with grep.patternType=fixed' '
        test_cmp expected actual
 '
 
-test_config() {
-       git config "$1" "$2" &&
-       test_when_finished "git config --unset $1"
-}
-
 cat >expected <<EOF
 hello.c<RED>:<RESET>int main(int argc, const char **argv)
 hello.c<RED>-<RESET>{