+test_expect_success 'grep -G invalidpattern properly dies ' '
+ test_must_fail git grep -G "a["
+'
+
+test_expect_success 'grep -E invalidpattern properly dies ' '
+ test_must_fail git grep -E "a["
+'
+
+test_expect_success LIBPCRE 'grep -P invalidpattern properly dies ' '
+ test_must_fail git grep -P "a["
+'
+
+test_expect_success 'grep -F -E -G pattern' '
+ echo ab:a+b >expected &&
+ git grep -F -E -G a+b >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'grep -F -G -E pattern' '
+ echo ab:aab >expected &&
+ git grep -F -G -E a+b >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'grep -E -F -G pattern' '
+ echo ab:aab >expected &&
+ git grep -E -F -G a\\+b >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'grep -E -G -F pattern' '
+ echo ab:a\\+b >expected &&
+ git grep -E -G -F a\\+b >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'grep -G -F -E pattern' '
+ echo ab:a+b >expected &&
+ git grep -G -F -E a\\+b >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success LIBPCRE 'grep -E -G -F -P pattern' '
+ echo ab:a+b >expected &&
+ git grep -E -G -F -P a\\+b >actual &&
+ test_cmp expected actual
+'
+