Skip to contentSkip to conversation

fetch/git: Update packing commands to match modern git

PATCH New Richard Purdie 1 participant 1 message Mar 26

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch/git: Update packing commands to match modern git

We are using a git command, "git pack-redundant" which is due to be removed from git. There is discussion about bitbake's usage here:

https://lore.kernel.org/git/CANYiYbHOczhRoJkOofFNQ6VA3BiyOF=QjffFBDvLn43Ts8B67w@mail.gmail.com/T/#t

As mentioned, we should switch to use git repack -adk. We need the k option since we do need to keep unreachable object to retain history.

As per the manuals, we still need to run prune-packed to remove loose objects which are now in the pack files.

---
 lib/bb/fetch2/git.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/fetch2/git.py +2 -2
index 84fecdad07e..6457463402c 100644
@@ -475,9 +475,9 @@ class Git(FetchMethod):
                 bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
             progresshandler = GitProgressHandler(d)
             runfetchcmd(fetch_cmd, d, log=progresshandler, workdir=ud.clonedir)
-            runfetchcmd("%s prune-packed" % ud.basecmd, d, workdir=ud.clonedir)
+            runfetchcmd("%s repack -adk" % ud.basecmd, d, workdir=ud.clonedir)
             runfetchcmd("%s pack-refs --all" % ud.basecmd, d, workdir=ud.clonedir)
-            runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d, workdir=ud.clonedir)
+            runfetchcmd("%s prune-packed" % ud.basecmd, d, workdir=ud.clonedir)
             try:
                 os.unlink(ud.fullmirror)
             except OSError as exc: