builder: Check if .gitmodules exists before showing it. Fixes #366

This commit checks if <revision>:.gitmodules exists in the repo before
calling git-show on it, so an error message doesn't show up in the
program's output.
tingping/wmclass
Matthew Leeds 2016-10-31 23:26:23 -05:00 committed by Alexander Larsson
parent 6e31932221
commit 8b50648ec0
1 changed files with 8 additions and 0 deletions

View File

@ -277,11 +277,15 @@ git_mirror_submodules (const char *repo_location,
GError **error)
{
g_autoptr(GKeyFile) key_file = g_key_file_new ();
g_autofree gchar *rev_parse_output = NULL;
g_autofree gchar *submodule_data = NULL;
g_autofree gchar **submodules = NULL;
g_autofree gchar *gitmodules = g_strconcat (revision, ":.gitmodules", NULL);
gsize num_submodules;
if (!git (mirror_dir, &rev_parse_output, NULL, "rev-parse", "--verify", "--quiet", gitmodules, NULL))
return TRUE;
if (git (mirror_dir, &submodule_data, NULL, "show", gitmodules, NULL))
{
if (!g_key_file_load_from_data (key_file, submodule_data, -1,
@ -413,11 +417,15 @@ git_extract_submodule (const char *repo_location,
GError **error)
{
g_autoptr(GKeyFile) key_file = g_key_file_new ();
g_autofree gchar *rev_parse_output = NULL;
g_autofree gchar *submodule_data = NULL;
g_autofree gchar **submodules = NULL;
g_autofree gchar *gitmodules = g_strconcat (revision, ":.gitmodules", NULL);
gsize num_submodules;
if (!git (checkout_dir, &rev_parse_output, NULL, "rev-parse", "--verify", "--quiet", gitmodules, NULL))
return TRUE;
if (git (checkout_dir, &submodule_data, NULL, "show", gitmodules, NULL))
{
if (!g_key_file_load_from_data (key_file, submodule_data, -1,