1
1
# geometry_git - please see the readme for documentation on all features
2
2
3
+ _geometry_git_guard() {
4
+ git rev-parse 2>/dev/null
5
+ }
6
+
3
7
geometry_git_stashes() {
8
+ _geometry_git_guard || return
4
9
git rev-parse --quiet --verify refs/stash >/dev/null \
5
10
&& ansi ${GEOMETRY_GIT_COLOR_STASHES:="144"} ${GEOMETRY_GIT_SYMBOL_STASHES:="●"}
6
11
}
@@ -16,6 +21,7 @@ geometry_git_time() {
16
21
}
17
22
18
23
geometry_git_branch() {
24
+ _geometry_git_guard || return
19
25
ansi ${GEOMETRY_GIT_COLOR_BRANCH:-242} $(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)
20
26
}
21
27
@@ -29,6 +35,7 @@ geometry_git_status() {
29
35
}
30
36
31
37
geometry_git_rebase() {
38
+ _geometry_git_guard || return
32
39
local git_dir
33
40
git_dir=$(git rev-parse --git-dir)
34
41
[[ -d "$git_dir/rebase-merge" ]] || [[ -d "$git_dir/rebase-apply" ]] || return
@@ -51,6 +58,7 @@ geometry_git_remote() {
51
58
}
52
59
53
60
geometry_git_conflicts() {
61
+ _geometry_git_guard || return
54
62
local _grep
55
63
local conflicts conflict_list
56
64
local file_count raw_file_count
@@ -78,7 +86,7 @@ geometry_git_conflicts() {
78
86
geometry_git() {
79
87
(( $+commands[git] )) || return
80
88
81
- git rev-parse 2>/dev/null || return
89
+ _geometry_git_guard || return
82
90
83
91
$(git rev-parse --is-bare-repository) \
84
92
&& ansi ${GEOMETRY_GIT_COLOR_BARE:=blue} ${GEOMETRY_GIT_SYMBOL_BARE:="⬢"} \
0 commit comments