From 591ebafe68938569983d94629901a44cd191cdfe Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Tue, 6 Dec 2022 18:05:07 +0000 Subject: [PATCH] Fix external changes patching when issue number ends with <= 09 A change ref's format is: refs/changes/X/Y/Z where X is last two digits of the CL number, Y is the entire number, and Z is the patchset number. In cases where Y ends in XXXX09, for example, we incorrectly fetch refs/9/XXXX09 instead of refs/09/XXXX09. Bug: 1382528 Change-Id: Icc0b08e9ee451a75c07039913418a6802b2b62fd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4080591 Reviewed-by: Josip Sokcevic Commit-Queue: Gavin Mak Auto-Submit: Gavin Mak --- git_cl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_cl.py b/git_cl.py index 4b26d5ead..9708895b9 100755 --- a/git_cl.py +++ b/git_cl.py @@ -2789,7 +2789,7 @@ class Changelist(object): # Get the diff between local_ps and external_ps. issue = self.GetIssue() - changes_ref = 'refs/changes/%d/%d/' % (issue % 100, issue) + changes_ref = 'refs/changes/%02d/%d/' % (issue % 100, issue) RunGitSilent(['fetch', remote, changes_ref + str(local_ps)]) last_uploaded = RunGitSilent(['rev-parse', 'FETCH_HEAD']).strip() RunGitSilent(['fetch', remote, changes_ref + str(external_ps)])