浏览代码

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
khenarghot 8 年之前
父节点
当前提交
292a62e3ab
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      themes/dogenpunk.zsh-theme

+ 1 - 1
themes/dogenpunk.zsh-theme

@@ -37,7 +37,7 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
 function git_time_since_commit() {
     if git rev-parse --git-dir > /dev/null 2>&1; then
         # Only proceed if there is actually a commit.
-        if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
+        if git log -n 1  > /dev/null 2>&1; then
             # Get the last commit.
             last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
             now=`date +%s`