mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-24 04:29:25 +02:00
Fix empty Git empty repo check
The default grep do not parse regular expression and we have no reason for read full log.
This commit is contained in:
parent
75f2f4e027
commit
88351c7a3b
1 changed files with 1 additions and 1 deletions
|
|
@ -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 2>&1 > /dev/null | grep -Ec "^fatal: bad default revision") == 0 ]]; then
|
||||
# Get the last commit.
|
||||
last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
|
||||
now=`date +%s`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue