Fix git error when in repository with no commits

This commit is contained in:
Ilan Cosman 2021-01-24 14:44:05 -08:00
parent 8b5a815cb8
commit 12da651992

View File

@ -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