master
Martin Gondermann 13 years ago
parent c869a349f1
commit 08355a2306
  1. 28
      gitprompt.sh

@ -95,18 +95,18 @@ function setGitPrompt() {
git_prompt_config git_prompt_config
local repo=`git rev-parse --show-toplevel 2> /dev/null` local repo=`git rev-parse --show-toplevel 2> /dev/null`
if [[ ! -e "${repo}" ]]; then if [[ ! -e "${repo}" ]]; then
PS1="${EMPTY_PROMPT}" PS1="${EMPTY_PROMPT}"
return return
fi fi
local FETCH_HEAD="${repo}/.git/FETCH_HEAD" local FETCH_HEAD="${repo}/.git/FETCH_HEAD"
# Fech repo if local is stale for more than $GIT_FETCH_TIMEOUT minutes # Fech repo if local is stale for more than $GIT_FETCH_TIMEOUT minutes
if [[ ! -e "${FETCH_HEAD}" || -e `find ${FETCH_HEAD} -mmin +${GIT_PROMPT_FETCH_TIMEOUT}` ]] if [[ ! -e "${FETCH_HEAD}" || -e `find ${FETCH_HEAD} -mmin +${GIT_PROMPT_FETCH_TIMEOUT}` ]]
then then
git fetch --quiet git fetch --quiet
fi fi
local -a GitStatus local -a GitStatus
GitStatus=($("${__GIT_STATUS_CMD}" 2>/dev/null)) GitStatus=($("${__GIT_STATUS_CMD}" 2>/dev/null))
@ -137,15 +137,19 @@ function setGitPrompt() {
if [ "${GIT_CONFLICTS}" -ne "0" ]; then if [ "${GIT_CONFLICTS}" -ne "0" ]; then
STATUS="${STATUS}${GIT_PROMPT_CONFLICTS}${GIT_CONFLICTS}${ResetColor}" STATUS="${STATUS}${GIT_PROMPT_CONFLICTS}${GIT_CONFLICTS}${ResetColor}"
fi fi
if [ "${GIT_CHANGED}" -ne "0" ]; then if [ "${GIT_CHANGED}" -ne "0" ]; then
STATUS="${STATUS}${GIT_PROMPT_CHANGED}${GIT_CHANGED}${ResetColor}" STATUS="${STATUS}${GIT_PROMPT_CHANGED}${GIT_CHANGED}${ResetColor}"
fi fi
if [ "${GIT_UNTRACKED}" -ne "0" ]; then if [ "${GIT_UNTRACKED}" -ne "0" ]; then
STATUS="${STATUS}${GIT_PROMPT_UNTRACKED}${GIT_UNTRACKED}${ResetColor}" STATUS="${STATUS}${GIT_PROMPT_UNTRACKED}${GIT_UNTRACKED}${ResetColor}"
fi fi
if [ "${GIT_CLEAN}" -eq "1" ]; then if [ "${GIT_CLEAN}" -eq "1" ]; then
STATUS="${STATUS}${GIT_PROMPT_CLEAN}" STATUS="${STATUS}${GIT_PROMPT_CLEAN}"
fi fi
STATUS="${STATUS}${ResetColor}${GIT_PROMPT_SUFFIX}" STATUS="${STATUS}${ResetColor}${GIT_PROMPT_SUFFIX}"

Loading…
Cancel
Save