diff options
author | Andrew Scott <andj.scott@gmail.com> | 2016-06-02 03:49:00 +0300 |
---|---|---|
committer | Andrew Scott <andj.scott@gmail.com> | 2016-06-12 16:52:10 +0300 |
commit | c3019d11ef2a8e1b550b4d05e22473ef6e3e8596 (patch) | |
tree | 941cf9eed062a335d57efe84dd218d6540222c15 | |
parent | 41888bf2a96e13a33db696c51963986472c9d91f (diff) |
Handle shorting path when in the .git directory
`git rev-parse --git-dir` returns just `.` when in the top level of
a`.git` directory. This would cause a problem when extracting the
package_path. Closes #271
-rwxr-xr-x | powerlevel9k.zsh-theme | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4206bf51..b3873429 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -475,6 +475,10 @@ prompt_dir() { package_path="." subdirectory_path="" else + # Handle the edge case where $repo_path is '.' due to the current directory being the .git directory. + if [[ "$repo_path" == "." ]]; then + repo_path=$(pwd) + fi # If the current path is something else, get the path to the package.json # file by finding the repo path and removing the '.git` from the path package_path=${repo_path:0:-4} |