forked from Mirrors/flatpak-builder
Ensure shallow repo mirror is updated when the git ref changes
Shallow clones only contain the ref that was cloned, and so if a mirror is shallow and the ref is changed in a subsequent invocation of builder, the new ref is absent and git fails with an error. This patch avoids bailing out too soon when mirroring a repo if the requested ref does not exist, to ensure it is fetched. Fixes #285 Closes: #286 Approved by: alexlarssonauto
parent
982e86f840
commit
068a598025
|
@ -531,8 +531,10 @@ builder_git_mirror_repo (const char *repo_location,
|
||||||
else
|
else
|
||||||
cached_git_dir = g_object_ref (cache_mirror_dir);
|
cached_git_dir = g_object_ref (cache_mirror_dir);
|
||||||
|
|
||||||
/* If we're not updating, only pull from cache to avoid network i/o */
|
/* If the ref already exists (it may not with a shallow mirror
|
||||||
if (!update)
|
* if it has changed) and we're not updating, only pull from
|
||||||
|
* cache to avoid network i/o. */
|
||||||
|
if (already_exists && !update)
|
||||||
{
|
{
|
||||||
if (cached_git_dir)
|
if (cached_git_dir)
|
||||||
origin = g_file_get_uri (cached_git_dir);
|
origin = g_file_get_uri (cached_git_dir);
|
||||||
|
|
Loading…
Reference in New Issue