mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-29 14:50:08 +00:00
Fix error with truncating package name if repo is symlinked
This commit is contained in:
parent
a58e8bdc8c
commit
a576a15759
1 changed files with 8 additions and 1 deletions
|
@ -587,7 +587,14 @@ prompt_dir() {
|
||||||
|
|
||||||
# Get the path of the Git repo, which should have the package.json file
|
# 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
|
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
|
elif [[ $(git rev-parse --is-inside-git-dir 2> /dev/null) == "true" ]]; then
|
||||||
package_path=${$(pwd)%%/.git*}
|
package_path=${$(pwd)%%/.git*}
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue