]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/submodule--helper.c
submodule init: fail gracefully with a missing .gitmodules file
authorStefan Beller <sbeller@google.com>
Thu, 28 Apr 2016 20:02:45 +0000 (13:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Apr 2016 17:05:24 +0000 (10:05 -0700)
commitd92028a575dde9c325e23f89c3d2b24f13868c57
treee6ea58d26e09d74c1a78fe54c3e2ef052a1e56c3
parent3604242f080a813d6f20a7394def422d1e55b30e
submodule init: fail gracefully with a missing .gitmodules file

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 `submodule init` was implemented in shell,
a missing .gitmodules file would result in an error message

    No url found for submodule path '%s' in .gitmodules

Replicate that error message for now.

When the .gitmodules file is missing we can probably fail even earlier
for all of the submodules with an improved error message.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
t/t7400-submodule-basic.sh