[bitbake-devel] [RFC PATCH 2/5] bb.fetch.git: truncate branches to SRCREV

Christopher Larson kergoth at gmail.com
Thu Aug 13 23:46:36 UTC 2015


From: Christopher Larson <chris_larson at mentor.com>

Rather than keeping the commits between SRCREV and the branch HEAD, point the
remote branch at the SRCREV, so no commits after SRCREV are kept. If the user
needs them, a git fetch will pull them down.

Signed-off-by: Christopher Larson <chris_larson at mentor.com>
---
 lib/bb/fetch2/git.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index e88736d..c19b111 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -299,6 +299,11 @@ class Git(FetchMethod):
                     runfetchcmd("%s remote add origin %s" % (ud.basecmd, ud.clonedir), d)
                     for name, branch in ud.branches.iteritems():
                         runfetchcmd("%s fetch -a origin %s" % (ud.basecmd, branch), d)
+                        runfetchcmd("%s update-ref refs/remotes/origin/%s %s" % (ud.basecmd, branch, ud.revisions[name]), d)
+                    runfetchcmd("%s gc --prune" % ud.basecmd, d)
+                    runfetchcmd("%s prune-packed" % ud.basecmd, d)
+                    runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d)
+
                     repourl = self._get_repo_url(ud)
                     runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d)
                     logger.info("Creating ud.fullmirror of git repository")
-- 
2.2.1




More information about the bitbake-devel mailing list