Skip to content
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

Merged
merged 1 commit into from
Feb 11, 2017

Conversation

dritter
Copy link
Member

@dritter dritter commented Jan 25, 2017

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 using git to find the root path of a repository, where potentially a package.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 a package.json in /tmp/repo the truncation looked

before: My_Package3/12…/12…/12…/12…/12…/123456789
after: My_Package/1/12/123/12…/12…/12…/12…/12…/123456789

@bhilburn
Copy link
Member

Great catch, and nice PR, @dritter! I especially appreciate the good comments =)

@bhilburn bhilburn merged commit da75345 into Powerlevel9k:next Feb 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants