diff options
| author | Angel Petkov <apetkov86@gmail.com> | 2020-05-02 23:16:20 +0300 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2020-05-05 17:53:11 +0000 |
| commit | dbfbcb14c162ef8233a5a13a462ba86f5b99921a (patch) | |
| tree | ef0b8b9f046f95817229ad3f95dfde53fc1dc56a /project.py | |
| parent | d0ca0f6814247d18d28e35de08ba193c4cf8e028 (diff) | |
| download | git-repo-dbfbcb14c162ef8233a5a13a462ba86f5b99921a.tar.gz | |
project.py: Fix check for wild cardsv2.7
The intention of the check is to verify whether the target
file name contains a wild card. The code, however, assumes
that if the file is non-existent - it contains a wild card.
This has the side effect that a target file that does not
exist at the moment of the check is considered to contain a
wild card, this leads itself to softlink not being created.
Change-Id: I4e4cd7b5e1b8ce2e4b2edc9abf5a1147cd86242f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/265736
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Angel Petkov <apetkov86@gmail.com>
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -405,8 +405,8 @@ class _LinkFile(object): | |||
| 405 | else: | 405 | else: |
| 406 | src = _SafeExpandPath(self.git_worktree, self.src) | 406 | src = _SafeExpandPath(self.git_worktree, self.src) |
| 407 | 407 | ||
| 408 | if os.path.exists(src): | 408 | if not glob.has_magic(src): |
| 409 | # Entity exists so just a simple one to one link operation. | 409 | # Entity does not contain a wild card so just a simple one to one link operation. |
| 410 | dest = _SafeExpandPath(self.topdir, self.dest, skipfinal=True) | 410 | dest = _SafeExpandPath(self.topdir, self.dest, skipfinal=True) |
| 411 | # dest & src are absolute paths at this point. Make sure the target of | 411 | # dest & src are absolute paths at this point. Make sure the target of |
| 412 | # the symlink is relative in the context of the repo client checkout. | 412 | # the symlink is relative in the context of the repo client checkout. |
| @@ -414,7 +414,7 @@ class _LinkFile(object): | |||
| 414 | self.__linkIt(relpath, dest) | 414 | self.__linkIt(relpath, dest) |
| 415 | else: | 415 | else: |
| 416 | dest = _SafeExpandPath(self.topdir, self.dest) | 416 | dest = _SafeExpandPath(self.topdir, self.dest) |
| 417 | # Entity doesn't exist assume there is a wild card | 417 | # Entity contains a wild card. |
| 418 | if os.path.exists(dest) and not platform_utils.isdir(dest): | 418 | if os.path.exists(dest) and not platform_utils.isdir(dest): |
| 419 | _error('Link error: src with wildcard, %s must be a directory', dest) | 419 | _error('Link error: src with wildcard, %s must be a directory', dest) |
| 420 | else: | 420 | else: |
