Skip to content

Commit 2e617b0

Browse files
authored and
committed
Merge branch 'iliakan-master'
2 parents f2da28f + 709ff6c commit 2e617b0

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

gitprompt.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,15 @@ function updatePrompt() {
551551
}
552552

553553
__chk_gitvar_status 'REMOTE' '-n'
554-
__add_status "$GIT_PROMPT_SEPARATOR"
555-
__chk_gitvar_status 'STAGED' '-ne 0'
556-
__chk_gitvar_status 'CONFLICTS' '-ne 0'
557-
__chk_gitvar_status 'CHANGED' '-ne 0'
558-
__chk_gitvar_status 'UNTRACKED' '-ne 0'
559-
__chk_gitvar_status 'STASHED' '-ne 0'
560-
__chk_gitvar_status 'CLEAN' '-eq 1' -
554+
if [[ $GIT_CLEAN -eq 0 ]] || [[ $GIT_PROMPT_CLEAN != "" ]]; then
555+
__add_status "$GIT_PROMPT_SEPARATOR"
556+
__chk_gitvar_status 'STAGED' '-ne 0'
557+
__chk_gitvar_status 'CONFLICTS' '-ne 0'
558+
__chk_gitvar_status 'CHANGED' '-ne 0'
559+
__chk_gitvar_status 'UNTRACKED' '-ne 0'
560+
__chk_gitvar_status 'STASHED' '-ne 0'
561+
__chk_gitvar_status 'CLEAN' '-eq 1' -
562+
fi
561563
__add_status "$ResetColor$GIT_PROMPT_SUFFIX"
562564

563565
NEW_PROMPT="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$STATUS_PREFIX$STATUS$PROMPT_END"

gitstatus.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def get_stash():
8989
if st[0] == '#' and st[1] == '#':
9090
if re.search('Initial commit on', st[2]):
9191
branch = st[2].split(' ')[-1]
92+
elif re.search('No commits yet on', st[2]):
93+
branch = st[2].split(' ')[-1]
9294
elif re.search('no branch', st[2]): # detached status
9395
branch = get_tag_or_hash()
9496
elif len(st[2].strip().split('...')) == 1:
@@ -150,4 +152,3 @@ def get_stash():
150152
Print(out.encode('utf-8'))
151153
else:
152154
Print(out)
153-

gitstatus.sh

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ if [[ "$branch" == *"Initial commit on"* ]]; then
7272
IFS=" " read -ra fields <<< "$branch"
7373
branch="${fields[3]}"
7474
remote="_NO_REMOTE_TRACKING_"
75+
elif [[ "$branch" == *"No commits yet on"* ]]; then
76+
IFS=" " read -ra fields <<< "$branch"
77+
branch="${fields[4]}"
78+
remote="_NO_REMOTE_TRACKING_"
7579
elif [[ "$branch" == *"no branch"* ]]; then
7680
tag=$( git describe --tags --exact-match )
7781
if [[ -n "$tag" ]]; then

0 commit comments

Comments
 (0)