From ae3745656b1111c995e41ec70eaa4397eaea7951 Mon Sep 17 00:00:00 2001 From: Chenlin Fan Date: Mon, 9 Sep 2024 05:14:45 +0000 Subject: [PATCH] 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 Reviewed-by: Josip Sokcevic --- gclient_scm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gclient_scm.py b/gclient_scm.py index 0b44253f8..793505a92 100644 --- a/gclient_scm.py +++ b/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