project: 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: I16dbe8d9fe42ea45440afcb61404c753bff1930d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254330
Reviewed-by: Chanho Park <parkch98@gmail.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
diff --git a/project.py b/project.py
index 185507c..a305d72 100644
--- a/project.py
+++ b/project.py
@@ -382,7 +382,12 @@
Handles wild cards on the src linking all of the files in the source in to
the destination directory.
"""
- src = _SafeExpandPath(self.git_worktree, self.src)
+ # Some people use src="." to create stable links to projects. Lets allow
+ # that but reject all other uses of "." to keep things simple.
+ if self.src == '.':
+ src = self.git_worktree
+ else:
+ src = _SafeExpandPath(self.git_worktree, self.src)
if os.path.exists(src):
# Entity exists so just a simple one to one link operation.