Commit 292a62e3 authored by khenarghot's avatar khenarghot Committed by Marc Cornellà
Browse files

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
parent 774c4eca
...@@ -37,7 +37,7 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" ...@@ -37,7 +37,7 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
function git_time_since_commit() { function git_time_since_commit() {
if git rev-parse --git-dir > /dev/null 2>&1; then if git rev-parse --git-dir > /dev/null 2>&1; then
# Only proceed if there is actually a commit. # 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. # Get the last commit.
last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
now=`date +%s` now=`date +%s`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment