From 76844ba2926b53ed56f2275365a6518d11310b95 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 28 Feb 2021 17:08:55 -0500 Subject: [PATCH] project: skip clone bundles when we've already initialized the object dir The clone bundle logic assumes there is a one-to-one mapping between the projects/ and project-objects/ trees. When using shared projects (where we checkout different branches from the same project), this would lead us to fetching the same clone bundle multiple times. Automatically skip the clone bundle logic if the project-objects/ dir already exists. Bug: https://crbug.com/gerrit/10993 Change-Id: I82c6fa1faf8605fd56c104fcea2a43dd4eecbce4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/298682 Reviewed-by: Michael Mortensen Tested-by: Mike Frysinger --- project.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project.py b/project.py index b81c10a1..dbc3ae61 100644 --- a/project.py +++ b/project.py @@ -1081,6 +1081,12 @@ class Project(object): _warn("Cannot remove archive %s: %s", tarpath, str(e)) self._CopyAndLinkFiles() return True + + # If the shared object dir already exists, don't try to rebootstrap with a + # clone bundle download. We should have the majority of objects already. + if clone_bundle and os.path.exists(self.objdir): + clone_bundle = False + if is_new is None: is_new = not self.Exists if is_new: