ci_run_n_monitor: allow detached heads as well
When running on a detached head (eg. checkout of a tag or a specific commit), there is no active branch, so we can't perform this check; just skip it and assume the user knows what they're doing. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27578>
This commit is contained in:
@@ -20,7 +20,7 @@ from collections import defaultdict
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from functools import partial
|
||||
from itertools import chain
|
||||
from subprocess import check_output
|
||||
from subprocess import check_output, CalledProcessError
|
||||
from typing import TYPE_CHECKING, Iterable, Literal, Optional
|
||||
|
||||
import gitlab
|
||||
@@ -426,10 +426,15 @@ if __name__ == "__main__":
|
||||
REV = check_output(['git', 'rev-parse', REV]).decode('ascii').strip()
|
||||
|
||||
if args.rev == 'HEAD':
|
||||
try:
|
||||
branch_name = check_output([
|
||||
'git', 'symbolic-ref', '-q', 'HEAD',
|
||||
]).decode('ascii').strip()
|
||||
except CalledProcessError:
|
||||
branch_name = ""
|
||||
|
||||
# Ignore detached heads
|
||||
if branch_name:
|
||||
tracked_remote = check_output([
|
||||
'git', 'for-each-ref', '--format=%(upstream)',
|
||||
branch_name,
|
||||
|
Reference in New Issue
Block a user