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>
changes/42/5835142/8
Chenlin Fan 10 months ago committed by LUCI CQ
parent ab105459cb
commit ae3745656b

@ -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

Loading…
Cancel
Save