aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2017-02-11 18:12:17 +0300
committerGitHub <noreply@github.com>2017-02-11 18:12:17 +0300
commitda75345275b80af131852cbd0ba644bb6e4fd904 (patch)
treeeb34bcdb91d62603282cd8bb8868d29ae49bdc7e /powerlevel9k.zsh-theme
parentddcbc62a052106fa13042fa845524de1d95dd46c (diff)
parenta576a157599ef3b41b939c4e8dc5df8656c30023 (diff)
Merge pull request #387 from dritter/fix_truncate_with_package_name
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 0df17de0..044a0320 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -597,7 +597,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