submodule init: fail gracefully with a missing .gitmodules file
[gitweb.git] / t / t7400-submodule-basic.sh
index f99f674ac795b7b55c5fc678257bd7365c71e62d..df6b4da2ba46f479c035f77adee88591c54e1407 100755 (executable)
@@ -18,6 +18,14 @@ test_expect_success 'setup - initial commit' '
        git branch initial
 '
 
+test_expect_success 'submodule init aborts on missing .gitmodules file' '
+       test_when_finished "git update-index --remove sub" &&
+       git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
+       # missing the .gitmodules file here
+       test_must_fail git submodule init 2>actual &&
+       test_i18ngrep "No url found for submodule path" actual
+'
+
 test_expect_success 'configuration parsing' '
        test_when_finished "rm -f .gitmodules" &&
        cat >.gitmodules <<-\EOF &&