bash: don't use realpath in prompt
This commit is contained in:
@@ -56,15 +56,12 @@ prompt_function() {
|
|||||||
prompt+="$(whoami)@$(hostname)${RST}:"
|
prompt+="$(whoami)@$(hostname)${RST}:"
|
||||||
if root=$(git_root); then
|
if root=$(git_root); then
|
||||||
# If in a git repository, only print the path relative to the repo root
|
# If in a git repository, only print the path relative to the repo root
|
||||||
path=$(realpath --relative-to=$root $PWD)
|
path=$(git rev-parse --show-prefix)
|
||||||
ref=$(git symbolic-ref --short -q HEAD)
|
ref=$(git symbolic-ref --short -q HEAD)
|
||||||
if [[ $ref == "" ]]; then
|
if [[ $ref == "" ]]; then
|
||||||
ref="${WARN_COLOR}detached${GIT_COLOR}"
|
ref="${WARN_COLOR}detached${GIT_COLOR}"
|
||||||
fi
|
fi
|
||||||
dirty=$(git diff-index --quiet HEAD)
|
dirty=$(git diff-index --quiet HEAD)
|
||||||
if [[ $path == . ]]; then
|
|
||||||
path=""
|
|
||||||
fi
|
|
||||||
prompt+="${GIT_COLOR}[$(basename $root)@${ref}:${DIR_COLOR}${path}${fg}${GIT_COLOR}]${RST}"
|
prompt+="${GIT_COLOR}[$(basename $root)@${ref}:${DIR_COLOR}${path}${fg}${GIT_COLOR}]${RST}"
|
||||||
else
|
else
|
||||||
# If not in a git repo, print the full path
|
# If not in a git repo, print the full path
|
||||||
|
|||||||
Reference in New Issue
Block a user