aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2017-01-26 01:47:20 +0300
committerDominik Ritter <dritter03@googlemail.com>2017-01-26 01:48:40 +0300
commita576a157599ef3b41b939c4e8dc5df8656c30023 (patch)
treee617f55d8bf08a39d763be2074279b9519ce38a5 /powerlevel9k.zsh-theme
parenta58e8bdc8cf4c51c80dc9e63eef52e95214c54f2 (diff)
Fix error with truncating package name if repo is symlinked
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme9
1 files changed, 8 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index f104b789..38c2ceb4 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -587,7 +587,14 @@ prompt_dir() {
# Get the path of the Git repo, which should have the package.json file
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == "true" ]]; then
- package_path=$(git rev-parse --show-toplevel)
+ # Get path from the root of the git repository to the current dir
+ local gitPath=$(git rev-parse --show-prefix)
+ # Remove trailing slash from git path, so that we can
+ # remove that git path from the pwd.
+ gitPath=${gitPath%/}
+ package_path=${$(pwd)%%$gitPath}
+ # Remove trailing slash
+ package_path=${package_path%/}
elif [[ $(git rev-parse --is-inside-git-dir 2> /dev/null) == "true" ]]; then
package_path=${$(pwd)%%/.git*}
fi