Fix checkout of shallow repo.

Some manifest (cx.ring.RingGnome) had a git commit id that
was only tip of a non-branch ref (refs/changes/51/8051/8), which
was not cloned by a regular clone, so we need to switch to
a clone --mirror.

Closes: #50
Approved by: alexlarsson
tingping/wmclass
Alexander Larsson 2017-10-19 20:01:11 +02:00 committed by Atomic Bot
parent 9453867333
commit 15f3582e40
1 changed files with 11 additions and 1 deletions

View File

@ -658,14 +658,24 @@ builder_git_checkout (const char *repo_location,
g_autoptr(GFile) mirror_dir = NULL;
g_autofree char *mirror_dir_path = NULL;
g_autofree char *dest_path = NULL;
g_autofree char *dest_path_git = NULL;
mirror_dir = git_get_mirror_dir (repo_location, context);
mirror_dir_path = g_file_get_path (mirror_dir);
dest_path = g_file_get_path (dest);
dest_path_git = g_build_filename (dest_path, ".git", NULL);
/* We need to clone with --mirror so that we get all refs, including non-branch/tags */
if (!git (NULL, NULL, 0, error,
"clone", mirror_dir_path, dest_path, NULL))
"clone",
"--mirror",
mirror_dir_path, dest_path_git, NULL))
return FALSE;
/* Then we need to convert to regular */
if (!git (dest, NULL, 0, error,
"config", "--bool", "core.bare", "false", NULL))
return FALSE;
if (!git (dest, NULL, 0, error,