Browse Source

Use T/F for dirt detection

When decoupled from context of exit status, 0 and 1 can be confusing.
Alois Mahdal 6 years ago
parent
commit
79421be4af
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      src/include/facts.sh

+ 6
- 6
src/include/facts.sh View File

139
     local prerl         # pre-release keyword (from mkit.ini, eg. 'beta')
139
     local prerl         # pre-release keyword (from mkit.ini, eg. 'beta')
140
     local latest_tag    # latest git tag
140
     local latest_tag    # latest git tag
141
     local commit        # commit indicator (CURRENT_BRANCH.gHASH)
141
     local commit        # commit indicator (CURRENT_BRANCH.gHASH)
142
-    local dirty         # 0 if dirty, 1 if clean
142
+    local dirty=F       # F if dirty, T if clean
143
     local suffix        # version suffix
143
     local suffix        # version suffix
144
     prerl=$(ini 1value project:prerl)
144
     prerl=$(ini 1value project:prerl)
145
     grep ":" <<<"$prerl" \
145
     grep ":" <<<"$prerl" \
161
     then    # we are at a later commit than the last tag
161
     then    # we are at a later commit than the last tag
162
         commit="$(git_fact current_branch).g$(git_fact latest_sha)"
162
         commit="$(git_fact current_branch).g$(git_fact latest_sha)"
163
     fi
163
     fi
164
-    git_bool dirty; dirty=$?
164
+    git_bool dirty && dirty=T
165
     case "$dirty:$commit" in
165
     case "$dirty:$commit" in
166
-        1:)  suffix=""               ;;
167
-        0:)  suffix="+dirty"         ;;
168
-        1:*) suffix="+$commit"       ;;
169
-        0:*) suffix="+$commit.dirty" ;;
166
+        F:)  suffix=""               ;;
167
+        T:)  suffix="+dirty"         ;;
168
+        F:*) suffix="+$commit"       ;;
169
+        T:*) suffix="+$commit.dirty" ;;
170
         *)   suffix=MKIT_BUG
170
         *)   suffix=MKIT_BUG
171
              warn "MKIT_BUG: bad dirt/commit detection" ;;
171
              warn "MKIT_BUG: bad dirt/commit detection" ;;
172
     esac
172
     esac