]> git.rmz.io Git - dotfiles.git/commitdiff
zsh/prompt: don't try to populate git prompt if not in git repo
authorSamir Benmendil <me@rmz.io>
Sun, 31 Jan 2021 16:11:35 +0000 (16:11 +0000)
committerSamir Benmendil <me@rmz.io>
Sun, 31 Jan 2021 16:11:35 +0000 (16:11 +0000)
Just exit early here, rather than processing anything else.

zsh/lib/prompt.zsh

index c8ca45b3ce1435c75de87ed83520c9cfa29dd0de..aaa269426a3e0431fd7e13e154d349775bfc8242 100644 (file)
@@ -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.