Skip to content

Commit b100a88

Browse files
authored
Merge pull request #699 from xcp-ng/gln/remove-old-branches-qzok
2 parents e591558 + 3baeea5 commit b100a88

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

scripts/koji/koji_build.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ def is_old_branch(b):
7373

7474
def clean_old_branches(git_repo):
7575
with cd(git_repo):
76-
subprocess.check_call(['git', 'fetch'])
77-
remote_branches = (
78-
subprocess.check_output(['git', 'branch', '-rl', 'origin/koji/test/*/*']).decode().splitlines()
79-
)
80-
remote_branches = [b.strip()[len('origin/'):] for b in remote_branches]
76+
remote_branches = [
77+
line.split()[-1] for line in subprocess.check_output(['git', 'ls-remote']).decode().splitlines()
78+
]
79+
remote_branches = [b for b in remote_branches if b.startswith('refs/heads/koji/test/')]
8180
old_branches = [b for b in remote_branches if is_old_branch(b)]
8281
if old_branches:
8382
print("removing outdated remote branch(es)", flush=True)

0 commit comments

Comments
 (0)