From fbd5dd3a304e53bb795515d2f8e53001b7080949 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Mon, 22 Aug 2022 19:26:14 +0000 Subject: [PATCH] manifest_xml: improve topdir accuracy. Do not include a trailing path separator when submanifest_path is empty. Bug: https://crbug.com/gerrit/16104 Change-Id: Ia65e355de25bdb1067fe50ab1d47db6e798d5a71 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343674 Tested-by: LaMont Jones Reviewed-by: Mike Frysinger --- manifest_xml.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifest_xml.py b/manifest_xml.py index 84be8f4a..ea274c76 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -358,7 +358,10 @@ class XmlManifest(object): self.repodir = os.path.abspath(repodir) self._CheckLocalPath(submanifest_path) - self.topdir = os.path.join(os.path.dirname(self.repodir), submanifest_path) + self.topdir = os.path.dirname(self.repodir) + if submanifest_path: + # This avoids a trailing os.path.sep when submanifest_path is empty. + self.topdir = os.path.join(self.topdir, submanifest_path) if manifest_file != os.path.abspath(manifest_file): raise ManifestParseError('manifest_file must be abspath') self.manifestFile = manifest_file