From 565480588d2bff4205b437862505e77382189811 Mon Sep 17 00:00:00 2001 From: Conley Owens Date: Tue, 11 Feb 2014 18:44:58 -0800 Subject: [PATCH] Check for existence of refs upon initial fetch When we do an initial fetch and have not specified any branch etc, the following fetch command will not error: git fetch origin --tags +refs/heads/*:refs/remotes/origin/* In this change we make sure something got fetched and if not we report an error. This fixes the bug that occurs when we init using a bad manifest url and then are unable to init again (because a manifest project has been inited with no manifest). Change-Id: I6f8aaefc83a1837beb10b1ac90bea96dc8e61156 --- project.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project.py b/project.py index a1249a86..73a97812 100644 --- a/project.py +++ b/project.py @@ -1748,6 +1748,7 @@ class Project(object): cmd.append('--no-tags') else: cmd.append('--tags') + cmd.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) elif tag_name is not None: cmd.append('tag') @@ -1774,6 +1775,11 @@ class Project(object): time.sleep(random.randint(30, 45)) if initial: + # Ensure that some refs exist. Otherwise, we probably aren't looking + # at a real git repository and may have a bad url. + if not self.bare_ref.all: + ok = False + if alt_dir: if old_packed != '': _lwrite(packed_refs, old_packed)