|
@@ -140,8 +140,13 @@ semver() {
|
140
|
140
|
local latest_tag # latest git tag
|
141
|
141
|
local commit # commit indicator (CURRENT_BRANCH.gHASH)
|
142
|
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 || {
|
|
@@ -162,13 +167,16 @@ semver() {
|
162
|
167
|
commit="$(git_fact current_branch).g$(git_fact latest_sha)"
|
163
|
168
|
fi
|
164
|
169
|
git_bool dirty && dirty=T
|
165
|
|
- case "$dirty:$commit" in
|
166
|
|
- F:) suffix="" ;;
|
167
|
|
- T:) suffix="+dirty" ;;
|
168
|
|
- F:*) suffix="+$commit" ;;
|
169
|
|
- T:*) suffix="+$commit.dirty" ;;
|
170
|
|
- *) suffix=MKIT_BUG
|
171
|
|
- warn "MKIT_BUG: bad dirt/commit detection" ;;
|
|
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"
|