From: Samir Benmendil Date: Sun, 31 Jan 2021 16:11:35 +0000 (+0000) Subject: zsh/prompt: don't try to populate git prompt if not in git repo X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/34f20d2cbf651ec2b1366dd2bcbc1331929ac8fc?hp=57c928a116d305c17a194aa37807d2a7bbd74231 zsh/prompt: don't try to populate git prompt if not in git repo Just exit early here, rather than processing anything else. --- diff --git a/zsh/lib/prompt.zsh b/zsh/lib/prompt.zsh index c8ca45b..aaa2694 100644 --- a/zsh/lib/prompt.zsh +++ b/zsh/lib/prompt.zsh @@ -34,6 +34,9 @@ TRAPWINCH() { # Get the status of the working tree git_prompt_status() { + if ! git rev-parse --is-inside-work-tree &>/dev/null; then + return + fi local branch ahead behind local added deleted modified renamed unmerged untracked dirty # Use porcelain status for easy parsing.