diff options
author | Stefan Beller <sbeller@google.com> | 2016-04-28 13:02:46 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-29 10:07:13 -0700 |
commit | 08fdbdb153c138f0a2dc85949475fafb20853d96 (patch) | |
tree | f3d62ae553d8f4db4c025817eeca99df6886360c /t/t7400-submodule-basic.sh | |
parent | submodule init: fail gracefully with a missing .gitmodules file (diff) | |
download | tgif-08fdbdb153c138f0a2dc85949475fafb20853d96.tar.xz |
submodule--helper update-clone: abort gracefully on missing .gitmodules
When there is no .gitmodules file availabe to initialize a submodule
from, `submodule_from_path` just returns NULL. We need to check for
that and abort gracefully.
When `git submodule update` was implemented in shell, this error out
with the warning
Submodule path '%s' not initialized
Maybe you want to use 'update --init'?
Replicate that behavior for now instead of crashing.
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7400-submodule-basic.sh')
-rwxr-xr-x | t/t7400-submodule-basic.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index df6b4da2ba..814ee63194 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -26,6 +26,14 @@ test_expect_success 'submodule init aborts on missing .gitmodules file' ' test_i18ngrep "No url found for submodule path" actual ' +test_expect_success 'submodule update 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 + git submodule update sub 2>actual && + test_i18ngrep "Submodule path .sub. not initialized" actual +' + test_expect_success 'configuration parsing' ' test_when_finished "rm -f .gitmodules" && cat >.gitmodules <<-\EOF && |