Merge branch 'bugfix/checkout_ref_branch' into 'master'

bugfix: checkout ref failed for origin branches

See merge request espressif/esp-idf!16936
This commit is contained in:
Roland Dobai 2022-01-26 16:25:23 +00:00
commit 0ac6a105ef

View File

@ -86,10 +86,17 @@ if __name__ == '__main__':
for candidate in candidate_branches:
# check if the branch, tag or commit exists
try:
subprocess.check_call(['git', 'cat-file', '-t', candidate], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
subprocess.check_call(['git', 'cat-file', '-t', 'origin/{}'.format(candidate)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
ref_to_use = candidate
break
except subprocess.CalledProcessError:
try:
# For customized commits
subprocess.check_call(['git', 'cat-file', '-t', candidate], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
ref_to_use = candidate
break
except subprocess.CalledProcessError:
pass
continue
if ref_to_use: