浏览代码

gclient: fix gclient sync with revision ref

Check /refs/heads/ strictly as branch revision type. Any ref (e.g. /refs/changes/*) not a branch has no difference from a hash.

Bug:341208163
Change-Id: I23e8c577b099adb88917527f827da3b122997cb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5835142
Commit-Queue: Chenlin Fan <fancl@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Chenlin Fan 11 月之前
父节点
当前提交
ae3745656b
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      gclient_scm.py

+ 4 - 2
gclient_scm.py

@@ -761,12 +761,14 @@ class GitWrapper(SCMWrapper):
             # Rewrite remote refs to their local equivalents.
             revision = ''.join(remote_ref)
             rev_type = "branch"
-        elif revision.startswith('refs/'):
+        elif revision.startswith('refs/heads/'):
             # Local branch? We probably don't want to support, since DEPS should
             # always specify branches as they are in the upstream repo.
             rev_type = "branch"
         else:
-            # hash is also a tag, only make a distinction at checkout
+            # hash is also a tag, only make a distinction at checkout.
+            # Any ref (e.g. /refs/changes/*) not a branch has no difference from
+            # a hash.
             rev_type = "hash"
 
         # If we are going to introduce a new project, there is a possibility