git: Create fake refs that are not branches when doing shallow mirrors

When doing a shallow clone when bundling git sources we sometimes need
to create a ref in the source repo. This changes the ref used from
refs/heads/flatpak-builder/ref-$REF to refs/flatpak/ref-$REF.
In other words, it uses a custom ref rather than a branch, which has
less chance of conflicting with some existing branch.

Closes: #47
Approved by: alexlarsson
tingping/wmclass
Alexander Larsson 2017-10-12 17:37:14 +02:00 committed by Atomic Bot
parent 04cf19083e
commit 42da157c47
1 changed files with 3 additions and 2 deletions

View File

@ -406,9 +406,10 @@ builder_git_shallow_mirror_ref (const char *repo_location,
if (*full_ref == 0)
{
g_free (full_ref);
full_ref = g_strdup_printf ("flatpak-builder/ref-%s", ref);
/* We can't pull the commit id, so we create a ref we can pull */
full_ref = g_strdup_printf ("refs/flatpak/ref-%s", ref);
if (!git (cache_mirror_dir, NULL, 0, NULL,
"branch", "-f", full_ref, ref, NULL))
"update-ref", full_ref, ref, NULL))
return FALSE;
}