Merge branch 'master' of https://github.com/iliakan/bash-git-prompt into iliakan-master

master
8 years ago
commit 709ff6cd09
  1. 16
      gitprompt.sh
  2. 3
      gitstatus.py
  3. 4
      gitstatus.sh

@ -551,13 +551,15 @@ function updatePrompt() {
} }
__chk_gitvar_status 'REMOTE' '-n' __chk_gitvar_status 'REMOTE' '-n'
__add_status "$GIT_PROMPT_SEPARATOR" if [[ $GIT_CLEAN -eq 0 ]] || [[ $GIT_PROMPT_CLEAN != "" ]]; then
__chk_gitvar_status 'STAGED' '-ne 0' __add_status "$GIT_PROMPT_SEPARATOR"
__chk_gitvar_status 'CONFLICTS' '-ne 0' __chk_gitvar_status 'STAGED' '-ne 0'
__chk_gitvar_status 'CHANGED' '-ne 0' __chk_gitvar_status 'CONFLICTS' '-ne 0'
__chk_gitvar_status 'UNTRACKED' '-ne 0' __chk_gitvar_status 'CHANGED' '-ne 0'
__chk_gitvar_status 'STASHED' '-ne 0' __chk_gitvar_status 'UNTRACKED' '-ne 0'
__chk_gitvar_status 'CLEAN' '-eq 1' - __chk_gitvar_status 'STASHED' '-ne 0'
__chk_gitvar_status 'CLEAN' '-eq 1' -
fi
__add_status "$ResetColor$GIT_PROMPT_SUFFIX" __add_status "$ResetColor$GIT_PROMPT_SUFFIX"
NEW_PROMPT="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$STATUS_PREFIX$STATUS$PROMPT_END" NEW_PROMPT="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$STATUS_PREFIX$STATUS$PROMPT_END"

@ -89,6 +89,8 @@ for st in status:
if st[0] == '#' and st[1] == '#': if st[0] == '#' and st[1] == '#':
if re.search('Initial commit on', st[2]): if re.search('Initial commit on', st[2]):
branch = st[2].split(' ')[-1] branch = st[2].split(' ')[-1]
elif re.search('No commits yet on', st[2]):
branch = st[2].split(' ')[-1]
elif re.search('no branch', st[2]): # detached status elif re.search('no branch', st[2]): # detached status
branch = get_tag_or_hash() branch = get_tag_or_hash()
elif len(st[2].strip().split('...')) == 1: elif len(st[2].strip().split('...')) == 1:
@ -150,4 +152,3 @@ if python_version == 2:
Print(out.encode('utf-8')) Print(out.encode('utf-8'))
else: else:
Print(out) Print(out)

@ -72,6 +72,10 @@ if [[ "$branch" == *"Initial commit on"* ]]; then
IFS=" " read -ra fields <<< "$branch" IFS=" " read -ra fields <<< "$branch"
branch="${fields[3]}" branch="${fields[3]}"
remote="_NO_REMOTE_TRACKING_" remote="_NO_REMOTE_TRACKING_"
elif [[ "$branch" == *"No commits yet on"* ]]; then
IFS=" " read -ra fields <<< "$branch"
branch="${fields[4]}"
remote="_NO_REMOTE_TRACKING_"
elif [[ "$branch" == *"no branch"* ]]; then elif [[ "$branch" == *"no branch"* ]]; then
tag=$( git describe --tags --exact-match ) tag=$( git describe --tags --exact-match )
if [[ -n "$tag" ]]; then if [[ -n "$tag" ]]; then

Loading…
Cancel
Save