changeset 259:09e37b590785

A couple changes since some systems use different syntax
author Steve Huston <huston@princeton.edu>
date Thu, 28 Mar 2024 20:06:31 -0400
parents 7b3dbc32eac5
children 15543c169f36
files .bash_prompt
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.bash_prompt	Thu Mar 28 19:37:38 2024 -0400
+++ b/.bash_prompt	Thu Mar 28 20:06:31 2024 -0400
@@ -42,7 +42,9 @@
   fi
 
   # Set color based on clean/staged/dirty.
-  if [[ ${git_status} =~ "working tree clean" ]]; then
+  # Some versions of git say tree, some say directory
+  green_pattern="working (tree|directory) clean"
+  if [[ ${git_status} =~ ${green_pattern} ]]; then
     state="${GREEN}"
   elif [[ ${git_status} =~ "Changes to be committed" ]]; then
     state="${YELLOW}"
@@ -51,7 +53,7 @@
   fi
 
   # Set arrow icon based on status against remote.
-  remote_pattern="Your branch is (.*) of"
+  remote_pattern="Your branch is (.*)"
   if [[ ${git_status} =~ ${remote_pattern} ]]; then
     if [[ ${BASH_REMATCH[1]} == "ahead" ]]; then
       remote="↑"