bitbake: git-make-shallow: use stdin mode

when there are many refs to delete, using xargs to exec git can take a very long
time. make this faster by only running git update-ref with stdin mode.

for a repo with over 34000 git tags this makes git-make-shallow finish
in 2 seconds instead of 3 minutes for me.

(Bitbake rev: 2b815e42ec074a7f8667bbfaccaa69fc4a0ba788)

Signed-off-by: Nick Owens <nick.owens@eero.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Nick Owens
2025-01-04 18:18:49 -08:00
committed by Richard Purdie
parent b242f0a007
commit ef7755749b

View File

@@ -115,8 +115,8 @@ def filter_refs(refs):
all_refs = get_all_refs()
to_remove = set(all_refs) - set(refs)
if to_remove:
check_output(['xargs', '-0', '-n', '1'] + git_cmd + ['update-ref', '-d', '--no-deref'],
input=''.join(l + '\0' for l in to_remove))
check_output(git_cmd + ['update-ref', '--no-deref', '--stdin', '-z'],
input=''.join('delete ' + l + '\0\0' for l in to_remove) + 'commit\0')
def follow_history_intersections(revisions, refs):