From 386c2a232242759eb509e9038940fda0f5dd66e2 Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Wed, 26 Jan 2022 16:40:52 +0800 Subject: [PATCH] bugfix: checkout ref failed for origin branches --- tools/ci/checkout_project_ref.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/ci/checkout_project_ref.py b/tools/ci/checkout_project_ref.py index a05c61322f..a64e5f488a 100755 --- a/tools/ci/checkout_project_ref.py +++ b/tools/ci/checkout_project_ref.py @@ -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: