mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
lib/git.zsh: Speed-up git_prompt_ahead()
Use the `git rev-list` plumbing instead of `git log`, which allows us to do without grep. Limit the history to one commit as well.
This commit is contained in:
parent
a481661251
commit
fd44dfd03f
1 changed files with 1 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ git_remote_status() {
|
||||||
|
|
||||||
# Checks if there are commits ahead from remote
|
# Checks if there are commits ahead from remote
|
||||||
function git_prompt_ahead() {
|
function git_prompt_ahead() {
|
||||||
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
if [[ -n $(git rev-list -1 origin/$(current_branch)..HEAD 2>/dev/null) ]]; then
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue