forked from Mirrors/flatpak-builder
git: Disable shallow clones of submodules pre git 1.9.0
Fetching from shallow clones was added in 1.9.0, so we do deep clones of submodule repos before that to ensure submodule update works. Closes: #62 Approved by: alexlarssontingping/wmclass
parent
3d603320f2
commit
55f07e209a
|
@ -154,6 +154,12 @@ git_version_supports_fsck_and_shallow (void)
|
|||
return git_has_version (1,8,3,2);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
git_version_supports_fetch_from_shallow (void)
|
||||
{
|
||||
return git_has_version (1,9,0,0);
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
git_ls_remote (GFile *repo_dir,
|
||||
const char *remote,
|
||||
|
@ -335,6 +341,11 @@ git_mirror_submodules (const char *repo_location,
|
|||
g_autofree gchar *gitmodules = g_strconcat (revision, ":.gitmodules", NULL);
|
||||
gsize num_submodules;
|
||||
|
||||
/* Older versions of git can't fetch from shallow repos, so always clone submodule
|
||||
repos deeply so git submodule update works */
|
||||
if (!git_version_supports_fetch_from_shallow ())
|
||||
disable_shallow = TRUE;
|
||||
|
||||
if (!git (mirror_dir, &rev_parse_output, 0, NULL, "rev-parse", "--verify", "--quiet", gitmodules, NULL))
|
||||
return TRUE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue