From 3baeea514fca011018a7c2bbc160aceeb709bcbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Lehmann?= Date: Fri, 25 Apr 2025 14:50:01 +0200 Subject: [PATCH] use git ls-remote to search the old branches to remove MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git branch can't be used with these flags on the old version of git that comes with centos 7 Signed-off-by: Gaƫtan Lehmann --- scripts/koji/koji_build.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/koji/koji_build.py b/scripts/koji/koji_build.py index 5e25944..f0398f8 100755 --- a/scripts/koji/koji_build.py +++ b/scripts/koji/koji_build.py @@ -68,11 +68,10 @@ def is_old_branch(b): def clean_old_branches(git_repo): with cd(git_repo): - subprocess.check_call(['git', 'fetch']) - remote_branches = ( - subprocess.check_output(['git', 'branch', '-rl', 'origin/koji/test/*/*']).decode().splitlines() - ) - remote_branches = [b.strip()[len('origin/'):] for b in remote_branches] + remote_branches = [ + line.split()[-1] for line in subprocess.check_output(['git', 'ls-remote']).decode().splitlines() + ] + remote_branches = [b for b in remote_branches if b.startswith('refs/heads/koji/test/')] old_branches = [b for b in remote_branches if is_old_branch(b)] if old_branches: print("removing outdated remote branch(es)", flush=True)