From b54b6897a216e14006d3a7cb2573b51301ffa993 Mon Sep 17 00:00:00 2001 From: Max Regan Date: Wed, 15 Jul 2020 03:42:34 +0000 Subject: [PATCH] bash: don't use realpath in prompt --- .mgr_config/.bashrc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.mgr_config/.bashrc b/.mgr_config/.bashrc index 0f2f226..f4d9dd7 100644 --- a/.mgr_config/.bashrc +++ b/.mgr_config/.bashrc @@ -56,15 +56,12 @@ prompt_function() { prompt+="$(whoami)@$(hostname)${RST}:" if root=$(git_root); then # 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) if [[ $ref == "" ]]; then ref="${WARN_COLOR}detached${GIT_COLOR}" fi dirty=$(git diff-index --quiet HEAD) - if [[ $path == . ]]; then - path="" - fi prompt+="${GIT_COLOR}[$(basename $root)@${ref}:${DIR_COLOR}${path}${fg}${GIT_COLOR}]${RST}" else # If not in a git repo, print the full path