|
@@ -2,6 +2,29 @@
|
2
|
2
|
|
3
|
3
|
. "$MKIT_DIR/include/ini.sh" || die "cannot import ini.sh"
|
4
|
4
|
|
|
5
|
+git_bool() {
|
|
6
|
+ #
|
|
7
|
+ # Get git bool (ie. exit status counts) $1
|
|
8
|
+ #
|
|
9
|
+ local bool_name="$1"
|
|
10
|
+ git_present || warn "can't give bool outside git repo: $bool_name"
|
|
11
|
+ case "$bool_name" in
|
|
12
|
+ dirty_files)
|
|
13
|
+ git diff-files | grep -qm 1 .
|
|
14
|
+ ;;
|
|
15
|
+ dirty_index)
|
|
16
|
+ git diff-index HEAD | grep -qm 1 .
|
|
17
|
+ ;;
|
|
18
|
+ dirty)
|
|
19
|
+ git_bool dirty_files || git_bool dirty_index
|
|
20
|
+ ;;
|
|
21
|
+ *)
|
|
22
|
+ warn "unknown git bool asked: $bool_name"
|
|
23
|
+ return 2
|
|
24
|
+ ;;
|
|
25
|
+ esac
|
|
26
|
+}
|
|
27
|
+
|
5
|
28
|
git_fact() {
|
6
|
29
|
#
|
7
|
30
|
# Get git fact $1
|