forked from Mirrors/flatpak-builder
git: --unshallow if we do a full pull where we were previously shallow
Closes: #55 Approved by: alexlarssontingping/wmclass
parent
ac6a25c981
commit
17f659ee71
|
@ -321,9 +321,11 @@ builder_git_mirror_repo (const char *repo_location,
|
|||
{
|
||||
g_autoptr(GFile) cache_mirror_dir = NULL;
|
||||
g_autoptr(GFile) mirror_dir = NULL;
|
||||
g_autoptr(GFile) shallow_file = NULL;
|
||||
g_autofree char *current_commit = NULL;
|
||||
g_autoptr(GHashTable) refs = NULL;
|
||||
gboolean already_exists = FALSE;
|
||||
gboolean was_shallow = FALSE;
|
||||
|
||||
cache_mirror_dir = git_get_mirror_dir (repo_location, context);
|
||||
|
||||
|
@ -351,6 +353,10 @@ builder_git_mirror_repo (const char *repo_location,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
shallow_file = g_file_get_child (mirror_dir, "shallow");
|
||||
if (g_file_query_exists (shallow_file, NULL))
|
||||
was_shallow = TRUE;
|
||||
|
||||
if (git (mirror_dir, NULL, G_SUBPROCESS_FLAGS_STDERR_SILENCE, NULL,
|
||||
"cat-file", "-e", ref, NULL))
|
||||
already_exists = TRUE;
|
||||
|
@ -431,7 +437,9 @@ builder_git_mirror_repo (const char *repo_location,
|
|||
{
|
||||
g_print ("Fetching full git repo %s\n", repo_location);
|
||||
if (!git (mirror_dir, NULL, 0, error,
|
||||
"fetch", "-p", "--no-recurse-submodules", "--tags", origin, NULL))
|
||||
"fetch", "-p", "--no-recurse-submodules", "--tags", origin,
|
||||
was_shallow ? "--unshallow" : NULL,
|
||||
NULL))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue