diff --git a/functions/_tide_item_git.fish b/functions/_tide_item_git.fish index ed3cb8c..b6392be 100644 --- a/functions/_tide_item_git.fish +++ b/functions/_tide_item_git.fish @@ -1,7 +1,8 @@ function _tide_item_git # Branch or SHA set -l location (git branch --show-current 2>/dev/null) || return - git rev-parse --git-dir --short=8 HEAD | read --local --line gitDir sha + # Repository might not have any commits, in which case this would error + git rev-parse --git-dir --short=8 HEAD 2>/dev/null | read --local --line gitDir sha # Operation set -l operation @@ -38,7 +39,7 @@ function _tide_item_git # Upstream behind/ahead git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null | - read --local --delimiter=\t upstreamBehind upstreamAhead + read --local --delimiter=\t upstreamBehind upstreamAhead test "$upstreamBehind" = 0 && set -e upstreamBehind test "$upstreamAhead" = 0 && set -e upstreamAhead @@ -77,4 +78,4 @@ function _tide_item_git set_color $tide_git_stash_color printf '%s' ' *'$stash -end \ No newline at end of file +end