292a62e3abf1bc0e87c3e1ff0012ebf6e03eb241

Author
khenarghot <khenarghot@users.noreply.github.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Fix git emptiness check in dogenpunk theme (#5329)

The parsing output for full git log output too slow so it replaced
with last commit show request, wich cause error if repository is empty

Diff

 1diff --git a/themes/dogenpunk.zsh-theme b/themes/dogenpunk.zsh-theme
 2index d6719281d536c18b97b7c19e00b4c3198e656f2b..6a9921288a8b04024d6bb16d45f36841fb396bd0 100644
 3--- a/themes/dogenpunk.zsh-theme
 4+++ b/themes/dogenpunk.zsh-theme
 5@@ -37,7 +37,7 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
 6 function git_time_since_commit() {
 7     if git rev-parse --git-dir > /dev/null 2>&1; then
 8         # Only proceed if there is actually a commit.
 9-        if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
10+        if git log -n 1  > /dev/null 2>&1; then
11             # Get the last commit.
12             last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
13             now=`date +%s`