build_koji: don't break when starting on a detached head

Signed-off-by: Yann Dirson <yann.dirson@vates.tech>
This commit is contained in:
Yann Dirson committed 2025-08-29 16:27:00 +02:00
1 parent 673284aa50
commit d981b4acde
1 file changed
+2 -1
+2 -1
View File
@@ -90,7 +90,8 @@ def local_branch(branch):
try:
yield branch
finally:
subprocess.check_call(['git', 'checkout', prev_branch])
# prev_branch is empty when the head was detached
subprocess.check_call(['git', 'checkout', prev_branch or commit])
def is_old_branch(b):
branch_time = datetime.strptime(b.split('/')[-1], TIME_FORMAT)