Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #387 from dritter/fix_truncate_with_package_name
Browse files Browse the repository at this point in the history
Fix error with truncating package name if repo is symlinked
  • Loading branch information
bhilburn authored Feb 11, 2017
2 parents ddcbc62 + a576a15 commit da75345
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion powerlevel9k.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da75345

Please sign in to comment.