From 823bab09c68b4048e433ab48b9185302c2f4b63a Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Tue, 18 Apr 2017 14:37:23 -0700 Subject: submodule.c: uninitialized submodules are ignored in recursive commands This was an oversight when working on the working tree modifying commands recursing into submodules. To test for uninitialized submodules, introduce another submodule "uninitialized_sub". Adding it via `submodule add` will activate the submodule in the preparation area (in create_lib_submodule_repo we setup all the things in submodule_update_repo), but the later tests will use a new testing repo that clones the preparation repo in which the new submodule is not initialized. By adding it to the branch "add_sub1", which is the starting point of all other branches, we have wide coverage. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- submodule.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'submodule.c') diff --git a/submodule.c b/submodule.c index 7c3c4b17fb..ccf8932731 100644 --- a/submodule.c +++ b/submodule.c @@ -1333,6 +1333,9 @@ int submodule_move_head(const char *path, struct child_process cp = CHILD_PROCESS_INIT; const struct submodule *sub; + if (!is_submodule_initialized(path)) + return 0; + sub = submodule_from_path(null_sha1, path); if (!sub) -- cgit v1.2.1