Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support to show nr of stashes #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gitstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
remote_ref = merge_name
else:
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
stashlist = Popen(['git', 'stash', 'list'],stdout=PIPE, stderr=PIPE).communicate()[0].decode("utf-8").splitlines()
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
revlist = revgit.communicate()[0]
if revgit.poll(): # fallback to local
Expand All @@ -60,6 +61,7 @@
conflicts,
changed,
untracked,
str(len(stashlist))
])
print(out)

7 changes: 6 additions & 1 deletion zshrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function update_current_git_vars() {
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5]
GIT_CHANGED=$__CURRENT_GIT_STATUS[6]
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
GIT_STASHES=$__CURRENT_GIT_STATUS[8]
}


Expand Down Expand Up @@ -80,7 +81,10 @@ git_super_status() {
if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
if [ "$GIT_STASHES" -ne "0" ]; then
STATUS="$STATUS $ZSH_THEME_GIT_PROMPT_STASHES$GIT_STASHES%{${reset_color}%}"
fi
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
echo "$STATUS"
fi
}
Expand All @@ -97,5 +101,6 @@ ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{…%G%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"
ZSH_THEME_GIT_PROMPT_STASHES="%{$fg_bold[yellow]%}%{⚑%G%}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the branch and the checkmark are bold. Status numbers aren't. Maybe this should just be $fg[yellow]?