diff options
author | Mike Frysinger <vapier@google.com> | 2020-02-10 17:10:03 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-02-10 23:19:31 +0000 |
commit | ae625410057cdf8e905282161af7cf1b353d3cc3 (patch) | |
tree | 8751e4e6ba3ca707647ea6bfd7787a2fb611cd59 /manifest_xml.py | |
parent | 83a3227b62c936b346b825b333fc2ca65528ecfd (diff) | |
download | git-repo-ae625410057cdf8e905282161af7cf1b353d3cc3.tar.gz |
manifest_xml: allow src=. with symlinks
Some Android/Nest manifests are using <linkfile> with src="." to
create stable paths to specific projects. Allow that specific
use case as it seems reasonable to support.
Bug: https://crbug.com/gerrit/11218
Change-Id: I5eadec257cd58ba0f8687c590ddc250a7a414a85
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254276
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 035cc61b..b92b2675 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -985,11 +985,13 @@ class XmlManifest(object): | |||
985 | # Assume paths might be used on case-insensitive filesystems. | 985 | # Assume paths might be used on case-insensitive filesystems. |
986 | path = path.lower() | 986 | path = path.lower() |
987 | 987 | ||
988 | # We don't really need to reject '.' here, but there shouldn't really be a | 988 | # Some people use src="." to create stable links to projects. Lets allow |
989 | # need to ever use it, so no need to accept it either. | 989 | # that but reject all other uses of "." to keep things simple. |
990 | for part in set(path.split(os.path.sep)): | 990 | parts = path.split(os.path.sep) |
991 | if part in {'.', '..', '.git'} or part.startswith('.repo'): | 991 | if parts != ['.']: |
992 | return 'bad component: %s' % (part,) | 992 | for part in set(parts): |
993 | if part in {'.', '..', '.git'} or part.startswith('.repo'): | ||
994 | return 'bad component: %s' % (part,) | ||
993 | 995 | ||
994 | if not symlink and path.endswith(os.path.sep): | 996 | if not symlink and path.endswith(os.path.sep): |
995 | return 'dirs not allowed' | 997 | return 'dirs not allowed' |