Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(This is just reopening PRs #1911, #1952 rebased on
master
.)Hello,
Please consider for integration this patch with fixes for symbolic link handling.
The principle addition is
PathUtils.getRelativeToCanonical(...)
and a new explicitForbiddenSymlinkException
.When PR #1846 was in progress, my testing showed it still had problems with history processing and also could not support nested symbolic links. I first cherry-picked most of #1846's contents but then revised its versions of
RuntimeEnvironment.getPathRelativeToSourceRoot(...)
andHistoryGuru.getRepository(...)
to instead use the newPathUtils
.I also kept #1846's new tests and added some more.
This patch also contains a new method,
Repository.getRepoRelativePath(...)
, to replace (pre-existing) problematic logic in the various repository implementations (e.g., Git, Mercurial, SVN, etc.) that was lopping off the front of paths assuming they started with "source root". E.g., on macOS, /var is a symlink to /private/var, and the logic was chopping off the number of characters in "/private/var/..." from "/var/...", resulting in paths mangled in the middle of segments.(I detected the problem while testing scenarios of symbolic-linked project layouts, but unit tests otherwise did not detect this bug.)
TESTING SCENARIOS:
Indexer
"automatically allow symlinks that are directly in source root".HistoryGuru
and history classes, though, are now fixed to properly work in this case.Indexer
will not have allowed this second symlink, so the new logic properly detects this as disallowed. This repo will not be indexed and will not show up in the UI.Indexer
will now allow this repo; it is handled byHistoryGuru
et al; and the repo will show up in the UI.Thank you.