git_superproject: Remove redundant _branch variable

Both variables were initialized to the same value and never modified.

Bug: 416589884
Change-Id: Iaa1ffffb4543d4cd9391ac679d9234fe01678861
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/576921
Tested-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Gavin Mak
2026-04-24 23:12:41 +00:00
committed by gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 134eeb024b
commit 12cfc6036a
2 changed files with 7 additions and 6 deletions
+6 -5
View File
@@ -100,7 +100,7 @@ class Superproject:
self._manifest = manifest
self.name = name
self.remote = remote
self.revision = self._branch = revision
self.revision = revision
self._repodir = manifest.repodir
self._superproject_dir = superproject_dir
self._superproject_path = manifest.SubmanifestInfoDir(
@@ -199,7 +199,8 @@ class Superproject:
def _LogMessagePrefix(self):
"""Returns the prefix string to be logged in each log message"""
return (
f"repo superproject branch: {self._branch} url: {self._remote_url}"
f"repo superproject revision: {self.revision} "
f"url: {self._remote_url}"
)
def _LogError(self, fmt, *inputs):
@@ -312,8 +313,8 @@ class Superproject:
if rev_commit:
cmd.extend(["--negotiation-tip", rev_commit])
if self._branch:
cmd += [self._branch + ":" + self._branch]
if self.revision:
cmd += [self.revision + ":" + self.revision]
p = GitCommand(
None,
cmd,
@@ -348,7 +349,7 @@ class Superproject:
)
return None
data = None
branch = "HEAD" if not self._branch else self._branch
branch = "HEAD" if not self.revision else self.revision
cmd = ["ls-tree", "-z", "-r", branch]
p = GitCommand(
+1 -1
View File
@@ -190,7 +190,7 @@ class SuperprojectTestCase(unittest.TestCase):
),
revision="refs/heads/main",
)
with mock.patch.object(self._superproject, "_branch", "junk"):
with mock.patch.object(self._superproject, "revision", "junk"):
sync_result = self._superproject.Sync(self.git_event_log)
self.assertFalse(sync_result.success)
self.assertTrue(sync_result.fatal)