Skip to main content

fish_functions/fish_prompt: suppress error output in non-Git repos

ID
e6882c3
date
2026-04-12 06:27:09+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
2aad261
message
fish_functions/fish_prompt: suppress error output in non-Git repos

In particular, if I'm not in a Git repo, I don't want this line to print:

> fatal: not a git repository (or any of the parent directories): .git
changed files
1 file, 1 addition, 1 deletion

Changed files

fish_functions/fish_prompt.fish (5262) → fish_functions/fish_prompt.fish (5274)

diff --git a/fish_functions/fish_prompt.fish b/fish_functions/fish_prompt.fish
index 42d362a..d80efc1 100644
--- a/fish_functions/fish_prompt.fish
+++ b/fish_functions/fish_prompt.fish
@@ -27,7 +27,7 @@ end
 function print_git_information
     which git 2>&1 >/dev/null
     
-    if git rev-parse --is-bare-repository >/dev/null
+    if git rev-parse --is-bare-repository 2>/dev/null >/dev/null
         return
     end