forked from Mirrors/flatpak-builder
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
parent
6e31932221
commit
8b50648ec0
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue