From ef7755749bb10e1f97774405b2695708b6cf36de Mon Sep 17 00:00:00 2001 From: Nick Owens Date: Sat, 4 Jan 2025 18:18:49 -0800 Subject: [PATCH] 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 Signed-off-by: Richard Purdie --- bitbake/bin/git-make-shallow | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitbake/bin/git-make-shallow b/bitbake/bin/git-make-shallow index 9de557c10e..8ad704fae5 100755 --- a/bitbake/bin/git-make-shallow +++ b/bitbake/bin/git-make-shallow @@ -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):