@@ -50,13 +50,22 @@ function git_prompt_config()
50
50
# local Time12a="(\$(date +%H:%M:%S))"
51
51
# local Time12a="(\@))"
52
52
local PathShort=" \w"
53
-
54
- PROMPT_START=" ${Yellow}${PathShort}${ResetColor} "
55
- PROMPT_END=" \n${White}${Time12a}${ResetColor} $ "
53
+
54
+ if [ " x${GIT_PROMPT_START} " == " x" ]; then
55
+ PROMPT_START=" ${Yellow}${PathShort}${ResetColor} "
56
+ else
57
+ PROMPT_START=" ${GIT_PROMPT_START} "
58
+ fi
59
+
60
+ if [ " x${GIT_PROMPT_END} " == " x" ]; then
61
+ PROMPT_END=" \n${White}${Time12a}${ResetColor} $ "
62
+ else
63
+ PROMPT_END=" ${GIT_PROMPT_END} "
64
+ fi
56
65
57
66
EMPTY_PROMPT=" ${PROMPT_START}${PROMPT_END} "
58
67
59
- # fetch remote revisions every other $GIT_PROMPT_FETCH_TIMEOUT (default 5) minutes
68
+ # fetch remote revisions every other $GIT_PROMPT_FETCH_TIMEOUT (default 5) minutes
60
69
GIT_PROMPT_FETCH_TIMEOUT=${1-5}
61
70
if [ " x$__GIT_STATUS_CMD " == " x" ]
62
71
then
@@ -91,7 +100,7 @@ function setGitPrompt() {
91
100
PS1=" ${EMPTY_PROMPT} "
92
101
return
93
102
fi
94
-
103
+
95
104
local FETCH_HEAD=" ${repo} /.git/FETCH_HEAD"
96
105
# Fech repo if local is stale for more than $GIT_FETCH_TIMEOUT minutes
97
106
if [[ ! -e " ${FETCH_HEAD} " || -e ` find ${FETCH_HEAD} -mmin +${GIT_PROMPT_FETCH_TIMEOUT} ` ]]
@@ -101,7 +110,7 @@ function setGitPrompt() {
101
110
102
111
local -a GitStatus
103
112
GitStatus=($( " ${__GIT_STATUS_CMD} " 2> /dev/null) )
104
-
113
+
105
114
local GIT_BRANCH=${GitStatus[0]}
106
115
local GIT_REMOTE=${GitStatus[1]}
107
116
if [[ " ." == " $GIT_REMOTE " ]]; then
0 commit comments