[prompt] fix prompt for gitster
This commit is contained in:
parent
5e82c5a57e
commit
f9da167a65
1 changed files with 3 additions and 11 deletions
|
@ -8,17 +8,9 @@ gst_get_status() {
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_get_pwd() {
|
gst_get_pwd() {
|
||||||
git_root=${PWD}
|
prompt_short_dir="$(short_pwd)"
|
||||||
while [[ ${git_root} != / && ! -e ${git_root}/.git ]]; do
|
git_root="$(command git rev-parse --show-toplevel 2> /dev/null)" && \
|
||||||
git_root=${git_root:h}
|
prompt_short_dir="${prompt_short_dir#${$(short_pwd $git_root):h}/}"
|
||||||
done
|
|
||||||
if [[ ${git_root} = / ]]; then
|
|
||||||
unset git_root
|
|
||||||
prompt_short_dir="$(short_pwd)"
|
|
||||||
else
|
|
||||||
parent=${git_root%\/*}
|
|
||||||
prompt_short_dir=${"$(short_pwd)"#${parent}/}
|
|
||||||
fi
|
|
||||||
print ${prompt_short_dir}
|
print ${prompt_short_dir}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue