mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-16 17:50:09 +00:00
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
This commit is contained in:
parent
41888bf2a9
commit
c3019d11ef
1 changed files with 4 additions and 0 deletions
|
@ -475,6 +475,10 @@ prompt_dir() {
|
||||||
package_path="."
|
package_path="."
|
||||||
subdirectory_path=""
|
subdirectory_path=""
|
||||||
else
|
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
|
# 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
|
# file by finding the repo path and removing the '.git` from the path
|
||||||
package_path=${repo_path:0:-4}
|
package_path=${repo_path:0:-4}
|
||||||
|
|
Loading…
Reference in a new issue