No need for __git_ps1 if not interactive
dblume

dblume commited on 2022-10-12 16:35:22
Showing 1 changed files, with 1 additions and 1 deletions.


Discovered when scp'ing a file from a Macintosh.
... ...
@@ -4,7 +4,7 @@ if [[ $(uname -s) != Darwin* ]] && [ -f /etc/bashrc ]; then
4 4
     . /etc/bashrc
5 5
 fi
6 6
 
7
-if ! $(declare -F __git_ps1 >/dev/null); then
7
+if [[ -v PS1 ]] && ! $(declare -F __git_ps1 >/dev/null); then
8 8
     # Try to source a file with __git_ps1
9 9
     if [[ -e /usr/lib/git-core/git-sh-prompt ]]; then
10 10
         . /usr/lib/git-core/git-sh-prompt
11 11