Bläddra i källkod

bugfix: checkout ref failed for origin branches

Chen Yudong 4 år sedan
förälder
incheckning
d48cbdd1e9
1 ändrade filer med 8 tillägg och 1 borttagningar
  1. 8 1
      tools/ci/checkout_project_ref.py

+ 8 - 1
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: