This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
Fix error with truncating package name if repo is symlinked #387
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.
There is a bug with
truncate_with_package_name
truncation strategy if the repo is symlinked. I encountered this bug, when writing a test for that strategy in #344 , as the temp dir in OSX is actually a symlink to/private/tmp
.The problem is that
git rev-parse --show-toplevel
always shows the real path on the file system that, if symlinked, is not the root path to the repo. Despite that usinggit
to find the root path of a repository, where potentially apackage.json
lies is not the best way, this PR just fixes the truncation problem. A better way would be going up a directory, until a package.json is dicovered (similar to @BenoitAverty approach in #353).In a folder
/tmp/repo/1/12/123/1234/12345/123456/1234567/12345678/123456789
, with apackage.json
in/tmp/repo
the truncation lookedbefore:
My_Package3/12…/12…/12…/12…/12…/123456789
after:
My_Package/1/12/123/12…/12…/12…/12…/12…/123456789