| Submitter | Jason Wessel |
|---|---|
| Date | June 14, 2012, 3:09 a.m. |
| Message ID | <1339643381-23026-5-git-send-email-jason.wessel@windriver.com> |
| Download | mbox | patch |
| Permalink | /patch/29803/ |
| State | New |
| Headers | show |
Comments
On Wed, 2012-06-13 at 22:09 -0500, Jason Wessel wrote: > A file:// url should use "clone -s" 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 | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py > index 1ad9213..f5a3983 100644 > --- a/lib/bb/fetch2/git.py > +++ b/lib/bb/fetch2/git.py > @@ -192,7 +192,13 @@ 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://"): > + use_s = "-s" > + repo = repourl[7:] > + else: > + use_s = "" > + repo = repourl > + clone_cmd = "%s clone %s --bare --mirror %s %s" % (ud.basecmd, use_s, repo, ud.clonedir) > if ud.proto.lower() != 'file': > bb.fetch2.check_network_access(d, clone_cmd) > runfetchcmd(clone_cmd, d) How about always using the -l option instead? This avoids the disadvantage of -s where you could corrupt the central mirror store with local changes in the checkout. Cheers, Richard
Patch
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py index 1ad9213..f5a3983 100644 --- a/lib/bb/fetch2/git.py +++ b/lib/bb/fetch2/git.py @@ -192,7 +192,13 @@ 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://"): + use_s = "-s" + repo = repourl[7:] + else: + use_s = "" + repo = repourl + clone_cmd = "%s clone %s --bare --mirror %s %s" % (ud.basecmd, use_s, repo, ud.clonedir) if ud.proto.lower() != 'file': bb.fetch2.check_network_access(d, clone_cmd) runfetchcmd(clone_cmd, d)
A file:// url should use "clone -s" 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)