Skip to content

Commit c99f419

Browse files
gasinveinbarthalion
authored andcommitted
Don't extract git submodules if not mirrored
1 parent a69dbe9 commit c99f419

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/builder-git.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ builder_git_checkout (const char *repo_location,
828828
const char *branch,
829829
GFile *dest,
830830
BuilderContext *context,
831+
FlatpakGitMirrorFlags mirror_flags,
831832
GError **error)
832833
{
833834
g_autoptr(GFile) mirror_dir = NULL;
@@ -857,8 +858,9 @@ builder_git_checkout (const char *repo_location,
857858
"checkout", branch, NULL))
858859
return FALSE;
859860

860-
if (!git_extract_submodule (repo_location, dest, branch, context, error))
861-
return FALSE;
861+
if (mirror_flags & FLATPAK_GIT_MIRROR_FLAGS_MIRROR_SUBMODULES)
862+
if (!git_extract_submodule (repo_location, dest, branch, context, error))
863+
return FALSE;
862864

863865
return TRUE;
864866
}

src/builder-git.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ gboolean builder_git_checkout (const char *repo_location,
4848
const char *branch,
4949
GFile *dest,
5050
BuilderContext *context,
51+
FlatpakGitMirrorFlags mirror_flags,
5152
GError **error);
5253
gboolean builder_git_shallow_mirror_ref (const char *repo_location,
5354
const char *destination_path,

src/builder-main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ main (int argc,
621621
git_branch,
622622
build_subdir,
623623
build_context,
624+
mirror_flags,
624625
&error))
625626
{
626627
g_printerr ("Can't check out manifest repo: %s\n", error->message);

src/builder-source-git.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,17 @@ builder_source_git_extract (BuilderSource *source,
285285
{
286286
BuilderSourceGit *self = BUILDER_SOURCE_GIT (source);
287287
g_autofree char *location = NULL;
288+
FlatpakGitMirrorFlags mirror_flags = 0;
288289

289290
location = get_url_or_path (self, context, error);
290291
if (location == NULL)
291292
return FALSE;
292293

294+
if (!self->disable_submodules)
295+
mirror_flags |= FLATPAK_GIT_MIRROR_FLAGS_MIRROR_SUBMODULES;
296+
293297
if (!builder_git_checkout (location, get_branch (self),
294-
dest, context, error))
298+
dest, context, mirror_flags, error))
295299
return FALSE;
296300

297301
return TRUE;

0 commit comments

Comments
 (0)