]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t7406-submodule-update.sh
submodule: reject submodule.update = !command in .gitmodules
[thirdparty/git.git] / t / t7406-submodule-update.sh
index 6f083c4d68b677ff4058961311d6f753d3953a54..779932457a531ad445b295e375a6289b2d14aefb 100755 (executable)
@@ -406,12 +406,12 @@ test_expect_success 'submodule update - command in .git/config' '
        )
 '
 
-test_expect_success 'submodule update - command in .gitmodules is ignored' '
+test_expect_success 'submodule update - command in .gitmodules is rejected' '
        test_when_finished "git -C super reset --hard HEAD^" &&
        git -C super config -f .gitmodules submodule.submodule.update "!false" &&
        git -C super commit -a -m "add command to .gitmodules file" &&
        git -C super/submodule reset --hard $submodulesha1^ &&
-       git -C super submodule update submodule
+       test_must_fail git -C super submodule update submodule
 '
 
 cat << EOF >expect
@@ -480,6 +480,9 @@ test_expect_success 'recursive submodule update - command in .git/config catches
 '
 
 test_expect_success 'submodule init does not copy command into .git/config' '
+       test_when_finished "git -C super update-index --force-remove submodule1" &&
+       test_when_finished git config -f super/.gitmodules \
+               --remove-section submodule.submodule1 &&
        (cd super &&
         H=$(git ls-files -s submodule | cut -d" " -f2) &&
         mkdir submodule1 &&
@@ -487,10 +490,9 @@ test_expect_success 'submodule init does not copy command into .git/config' '
         git config -f .gitmodules submodule.submodule1.path submodule1 &&
         git config -f .gitmodules submodule.submodule1.url ../submodule &&
         git config -f .gitmodules submodule.submodule1.update !false &&
-        git submodule init submodule1 &&
-        echo "none" >expect &&
-        git config submodule.submodule1.update >actual &&
-        test_cmp expect actual
+        test_must_fail git submodule init submodule1 &&
+        test_expect_code 1 git config submodule.submodule1.update >actual &&
+        test_must_be_empty actual
        )
 '