|
@@ -139,9 +139,14 @@ 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
|
+ local btime # hex timestamp or nothing (see $MKIT_TTAG)
|
143
|
144
|
local suffix # version suffix
|
144
|
145
|
prerl=$(ini 1value project:prerl)
|
|
146
|
+ case $MKIT_TTAG in
|
|
147
|
+ none) btime= ;;
|
|
148
|
+ btime) btime=$(printf '%08x' "$(date +%s)") ;;
|
|
149
|
+ esac
|
145
|
150
|
grep ":" <<<"$prerl" \
|
146
|
151
|
&& warn "colon in project:prerl may corrupt version data: $prerl"
|
147
|
152
|
git_present || {
|
|
@@ -161,14 +166,17 @@ semver() {
|
161
|
166
|
then # we are at a later commit than the last tag
|
162
|
167
|
commit="$(git_fact current_branch).g$(git_fact latest_sha)"
|
163
|
168
|
fi
|
164
|
|
- git_bool dirty; dirty=$?
|
165
|
|
- case "$dirty:$commit" in
|
166
|
|
- 1:) suffix="" ;;
|
167
|
|
- 0:) suffix="+dirty" ;;
|
168
|
|
- 1:*) suffix="+$commit" ;;
|
169
|
|
- 0:*) suffix="+$commit.dirty" ;;
|
170
|
|
- *) suffix=MKIT_BUG
|
171
|
|
- warn "MKIT_BUG: bad dirt/commit detection" ;;
|
|
169
|
+ git_bool dirty && dirty=T
|
|
170
|
+ case "$dirty:$btime:$commit" in
|
|
171
|
+ F:*:) suffix="" ;;
|
|
172
|
+ T::) suffix="+dirty" ;;
|
|
173
|
+ T:*:) suffix="+t$btime.dirty" ;;
|
|
174
|
+ F::*) suffix="+$commit" ;;
|
|
175
|
+ F:*:*) suffix="+t$btime.$commit" ;;
|
|
176
|
+ T::*) suffix="+$commit.dirty" ;;
|
|
177
|
+ T:*:*) suffix="+t$btime.$commit.dirty" ;;
|
|
178
|
+ *) suffix=MKIT_BUG
|
|
179
|
+ warn "MKIT_BUG: bad dirt/commit detection" ;;
|
172
|
180
|
esac
|
173
|
181
|
test -n "$prerl" && suffix="-$prerl$suffix"
|
174
|
182
|
echo "$xyz$suffix"
|