summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-03-10 23:35:44 -0500
committerMike Frysinger <vapier@google.com>2021-03-12 16:31:14 +0000
commit0458faa502e9992a4305bfbb282fbee344d505bf (patch)
treea91a10bd124b06c55c3a8ca522143d810070d1a6 /manifest_xml.py
parent68d5d4dfe5375be53f935c8b72060a56801dda24 (diff)
downloadgit-repo-0458faa502e9992a4305bfbb282fbee344d505bf.tar.gz
manifest: allow toplevel project checkoutsv2.13.5
Re-allow checking out projects to the top of the repo client checkout. We add checks to prevent checking out files under .repo/ as that path is only managed by us, and projects cannot inject content or settings into it. Bug: https://crbug.com/gerrit/14156 Bug: https://crbug.com/gerrit/14200 Change-Id: Id6bf9e882f5be748442b2c35bbeaee3549410b25 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/299623 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r--manifest_xml.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 6d8fca1d..d67ba72d 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -1039,7 +1039,8 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
1039 if not path: 1039 if not path:
1040 path = name 1040 path = name
1041 else: 1041 else:
1042 msg = self._CheckLocalPath(path, dir_ok=True) 1042 # NB: The "." project is handled specially in Project.Sync_LocalHalf.
1043 msg = self._CheckLocalPath(path, dir_ok=True, cwd_dot_ok=True)
1043 if msg: 1044 if msg:
1044 raise ManifestInvalidPathError( 1045 raise ManifestInvalidPathError(
1045 '<project> invalid "path": %s: %s' % (path, msg)) 1046 '<project> invalid "path": %s: %s' % (path, msg))
@@ -1227,7 +1228,9 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
1227 # our constructed logic here. Especially since manifest authors only use 1228 # our constructed logic here. Especially since manifest authors only use
1228 # / in their paths. 1229 # / in their paths.
1229 resep = re.compile(r'[/%s]' % re.escape(os.path.sep)) 1230 resep = re.compile(r'[/%s]' % re.escape(os.path.sep))
1230 parts = resep.split(path) 1231 # Strip off trailing slashes as those only produce '' elements, and we use
1232 # parts to look for individual bad components.
1233 parts = resep.split(path.rstrip('/'))
1231 1234
1232 # Some people use src="." to create stable links to projects. Lets allow 1235 # Some people use src="." to create stable links to projects. Lets allow
1233 # that but reject all other uses of "." to keep things simple. 1236 # that but reject all other uses of "." to keep things simple.