Преглед изворни кода

Use T/F for dirt detection

When decoupled from context of exit status, 0 and 1 can be confusing.
Alois Mahdal пре 6 година
родитељ
комит
79421be4af
1 измењених фајлова са 6 додато и 6 уклоњено
  1. 6
    6
      src/include/facts.sh

+ 6
- 6
src/include/facts.sh Прегледај датотеку

@@ -139,7 +139,7 @@ semver() {
139 139
     local prerl         # pre-release keyword (from mkit.ini, eg. 'beta')
140 140
     local latest_tag    # latest git tag
141 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 143
     local suffix        # version suffix
144 144
     prerl=$(ini 1value project:prerl)
145 145
     grep ":" <<<"$prerl" \
@@ -161,12 +161,12 @@ semver() {
161 161
     then    # we are at a later commit than the last tag
162 162
         commit="$(git_fact current_branch).g$(git_fact latest_sha)"
163 163
     fi
164
-    git_bool dirty; dirty=$?
164
+    git_bool dirty && dirty=T
165 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 170
         *)   suffix=MKIT_BUG
171 171
              warn "MKIT_BUG: bad dirt/commit detection" ;;
172 172
     esac