rebase -r: always reword merge -c
[gitweb.git] / t / t7814-grep-recurse-submodules.sh
index 3a58197f472f38c320de33fa82896c0a77d125ae..134a694516c924c5930b9c227da45e896297a338 100755 (executable)
@@ -33,6 +33,24 @@ test_expect_success 'grep correctly finds patterns in a submodule' '
        test_cmp expect actual
 '
 
+test_expect_success 'grep finds patterns in a submodule via config' '
+       test_config submodule.recurse true &&
+       # expect from previous test
+       git grep -e "(3|4)" >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'grep --no-recurse-submodules overrides config' '
+       test_config submodule.recurse true &&
+       cat >expect <<-\EOF &&
+       a:(1|2)d(3|4)
+       b/b:(3|4)
+       EOF
+
+       git grep -e "(3|4)" --no-recurse-submodules >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'grep and basic pathspecs' '
        cat >expect <<-\EOF &&
        submodule/a:(1|2)d(3|4)
@@ -362,4 +380,16 @@ test_expect_success 'grep --recurse-submodules should pass the pattern type alon
        fi
 '
 
+test_expect_success 'grep --recurse-submodules with submodules without .gitmodules in the working tree' '
+       test_when_finished "git -C submodule checkout .gitmodules" &&
+       rm submodule/.gitmodules &&
+       git grep --recurse-submodules -e "(.|.)[\d]" >actual &&
+       cat >expect <<-\EOF &&
+       a:(1|2)d(3|4)
+       submodule/a:(1|2)d(3|4)
+       submodule/sub/a:(1|2)d(3|4)
+       EOF
+       test_cmp expect actual
+'
+
 test_done