From ba5b5bc6b85b91ab2197a14652f0ced38c5fd608 Mon Sep 17 00:00:00 2001 From: Michael Spencer Date: Thu, 28 Jan 2016 12:46:40 -0600 Subject: [PATCH] builder: Skip checking out disabled submodules --- builder/builder-source-git.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/builder/builder-source-git.c b/builder/builder-source-git.c index 9e15a613..84a81791 100644 --- a/builder/builder-source-git.c +++ b/builder/builder-source-git.c @@ -415,6 +415,7 @@ git_extract_submodule (const char *repo_url, g_autoptr(GFile) child_dir = NULL; g_autofree char *child_url = NULL; g_autofree char *option = NULL; + g_autofree char *update_method = NULL; g_autofree char *child_relative_url = NULL; g_autofree char *mirror_dir_as_url = NULL; g_auto(GStrv) words = NULL; @@ -422,6 +423,18 @@ git_extract_submodule (const char *repo_url, continue; words = g_strsplit (lines[i] + 1, " ", 3); + // Skip any submodules that are disabled (have the update method set to "none") + // Only check if the command succeeds. If it fails, the update method is not set. + option = g_strdup_printf("submodule.%s.update", words[1]); + if (git(checkout_dir, &update_method, NULL, + "config", "-f", ".gitmodules", option, NULL)) { + /* Trim trailing whitespace */ + g_strchomp(update_method); + + if (g_strcmp0(update_method, "none") == 0) + continue; + } + option = g_strdup_printf ("submodule.%s.url", words[1]); if (!git (checkout_dir, &child_relative_url, error, "config", "-f", ".gitmodules", option, NULL))