Browse Source

giti: No output if no git repository

84582af
Dirk Alders 2 years ago
parent
commit
cca7099db6
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      giti

+ 4
- 0
giti View File

30
     git_status="$(LANGUAGE='en_US.UTF-8 git' git status 2> /dev/null)"
30
     git_status="$(LANGUAGE='en_US.UTF-8 git' git status 2> /dev/null)"
31
     git_diff="$(git  status --porcelain 2> /dev/null)"
31
     git_diff="$(git  status --porcelain 2> /dev/null)"
32
     #
32
     #
33
+    if [ -z "$git_status" ]; then
34
+      # No GIT repository
35
+      exit
36
+    fi
33
     if [[ $SHORT ]]; then
37
     if [[ $SHORT ]]; then
34
       if [[ ! $git_status =~ "working tree clean" ]] && [[ ! $git_status =~ "working directory clean" ]]; then
38
       if [[ ! $git_status =~ "working tree clean" ]] && [[ ! $git_status =~ "working directory clean" ]]; then
35
         git_status_color="$COLOR_RED"
39
         git_status_color="$COLOR_RED"

Loading…
Cancel
Save