|
|
@ -2,7 +2,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
# Source gitstatus.plugin.sh from $GITSTATUS_DIR or from the same directory
|
|
|
|
# Source gitstatus.plugin.sh from $GITSTATUS_DIR or from the same directory
|
|
|
|
# in which the current script resides if the variable isn't set.
|
|
|
|
# in which the current script resides if the variable isn't set.
|
|
|
|
if [[ -n "${GITSTATUS_DIR:-}" ]]; then
|
|
|
|
if [[ -n "${GITSTATUS_DIR-}" ]]; then
|
|
|
|
source "$GITSTATUS_DIR" || return
|
|
|
|
source "$GITSTATUS_DIR" || return
|
|
|
|
elif [[ "${BASH_SOURCE[0]}" == */* ]]; then
|
|
|
|
elif [[ "${BASH_SOURCE[0]}" == */* ]]; then
|
|
|
|
source "${BASH_SOURCE[0]%/*}/gitstatus.plugin.sh" || return
|
|
|
|
source "${BASH_SOURCE[0]%/*}/gitstatus.plugin.sh" || return
|
|
|
@ -85,7 +85,14 @@ function gitstatus_prompt_update() {
|
|
|
|
gitstatus_stop && gitstatus_start -s -1 -u -1 -c -1 -d -1
|
|
|
|
gitstatus_stop && gitstatus_start -s -1 -u -1 -c -1 -d -1
|
|
|
|
|
|
|
|
|
|
|
|
# On every prompt, fetch git status and set GITSTATUS_PROMPT.
|
|
|
|
# On every prompt, fetch git status and set GITSTATUS_PROMPT.
|
|
|
|
PROMPT_COMMAND=gitstatus_prompt_update
|
|
|
|
if [[ -z "${PROMPT_COMMAND[*]}" ]]; then
|
|
|
|
|
|
|
|
PROMPT_COMMAND=gitstatus_prompt_update
|
|
|
|
|
|
|
|
elif [[ ! "${PROMPT_COMMAND[*]}" =~ [[:space:]\;]?gitstatus_prompt_update[[:space:]\;]? ]]; then
|
|
|
|
|
|
|
|
# Note: If PROMPT_COMMAND is an array, this will modify its first element.
|
|
|
|
|
|
|
|
PROMPT_COMMAND=$'gitstatus_prompt_update\n'"$PROMPT_COMMAND"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Retain 3 trailing components of the current directory.
|
|
|
|
PROMPT_DIRTRIM=3
|
|
|
|
PROMPT_DIRTRIM=3
|
|
|
|
|
|
|
|
|
|
|
|
# Enable promptvars so that ${GITSTATUS_PROMPT} in PS1 is expanded.
|
|
|
|
# Enable promptvars so that ${GITSTATUS_PROMPT} in PS1 is expanded.
|
|
|
|