diff mbox series

fetch/git: Update packing commands to match modern git

Message ID 20260326155912.1504786-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 64fda8cb8efaff280d33bf60d93fed6e37244640
Headers show
Series fetch/git: Update packing commands to match modern git | expand

Commit Message

Richard Purdie March 26, 2026, 3:59 p.m. UTC
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/fetch2/git.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 84fecdad07e..6457463402c 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -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: