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

Christopher Larson kergoth at gmail.com
Wed Aug 26 16:38:08 UTC 2015


From: Christopher Larson <chris_larson at mentor.com>

This removes the commits after SRCREV up to the branch HEAD, as they aren't
needed for us, and just increase the size of the tarball. The user can always
`git fetch` to pull down those commits. Repack/prune the repository before
archiving it to ensure those commits are physically removed.

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

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 99cc508..3be32f2 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -288,6 +288,10 @@ class Git(FetchMethod):
         runfetchcmd("%s remote add origin %s" % (gitcmd, source), d)
         for name, (shallow, revision, branch) in branchinfo.iteritems():
             runfetchcmd("%s fetch -a origin %s" % (gitcmd, branch), d)
+            runfetchcmd("%s update-ref refs/remotes/origin/%s %s" % (gitcmd, branch, revision), d)
+        runfetchcmd("%s repack -Ad" % gitcmd, d)
+        runfetchcmd("%s prune --expire now" % gitcmd, d)
+        runfetchcmd("%s pack-redundant --all | xargs -r rm" % gitcmd, d)
         runfetchcmd("%s remote set-url origin %s" % (gitcmd, repourl), d)
 
     def build_mirror_data(self, ud, d):
-- 
2.2.1




More information about the bitbake-devel mailing list