Patchwork [bitbake-devel,v2,1/3] fetch2/git.py: Optimize clone fall back when it is local

login
register
mail settings
Submitter Jason Wessel
Date June 14, 2012, 9:44 p.m.
Message ID <1339710244-6755-2-git-send-email-jason.wessel@windriver.com>
Download mbox | patch
Permalink /patch/29905/
State Accepted
Commit 2bab2cc3ffe67ee2a308074a6e4c2c7be5636d2f
Headers show

Comments

Jason Wessel - June 14, 2012, 9:44 p.m.
A file:// url should use "clone -l" to greatly speed
up the clone in the case of a kernel when it is local.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 lib/bb/fetch2/git.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index ecc5e0d..07d722a 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -188,7 +188,9 @@  class Git(FetchMethod):
 
         # If the repo still doesn't exist, fallback to cloning it
         if not os.path.exists(ud.clonedir):
-            clone_cmd = "%s clone --bare --mirror %s %s" % (ud.basecmd, repourl, ud.clonedir)
+            if repourl.startswith("file://"):
+                repourl = repourl[7:]
+            clone_cmd = "%s clone -l --bare --mirror %s %s" % (ud.basecmd, repourl, ud.clonedir)
             if ud.proto.lower() != 'file':
                 bb.fetch2.check_network_access(d, clone_cmd)
             runfetchcmd(clone_cmd, d)