aboutsummaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-04-18 14:37:23 -0700
committerJunio C Hamano <gitster@pobox.com>2017-04-18 21:18:29 -0700
commit823bab09c68b4048e433ab48b9185302c2f4b63a (patch)
tree4ff69d43f6999d26a080dc37377a7b7de4c84ba7 /submodule.c
parentcd279e2e1b4f41f0272d90abb2ba5a06c544b3da (diff)
downloadgit-823bab09c68b4048e433ab48b9185302c2f4b63a.tar.gz
git-823bab09c68b4048e433ab48b9185302c2f4b63a.tar.xz
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 <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index 7c3c4b17f..ccf893273 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)