| 
				
			 | 
			
			
				@@ -54,6 +54,9 @@ git_fact() { 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				54
			 | 
			
			
				         latest_sha) 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				55
			 | 
			
			
				             git log -1 --pretty=format:%h HEAD 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				56
			 | 
			
			
				             ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				57
			 | 
			
			
				+        latest_cdate) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				58
			 | 
			
			
				+            git log -1 --format=%cd --date=unix HEAD 
			 | 
		
	
		
			
			| 
				
			 | 
			
				59
			 | 
			
			
				+            ;; 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				60
			 | 
			
			
				         *) 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				61
			 | 
			
			
				             warn "unknown git fact asked: $fact_name" 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				62
			 | 
			
			
				             ;; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -139,9 +142,15 @@ semver() { 
			 | 
		
	
		
			
			| 
				139
			 | 
			
				142
			 | 
			
			
				     local prerl         # pre-release keyword (from mkit.ini, eg. 'beta') 
			 | 
		
	
		
			
			| 
				140
			 | 
			
				143
			 | 
			
			
				     local latest_tag    # latest git tag 
			 | 
		
	
		
			
			| 
				141
			 | 
			
				144
			 | 
			
			
				     local commit        # commit indicator (CURRENT_BRANCH.gHASH) 
			 | 
		
	
		
			
			| 
				142
			 | 
			
				
			 | 
			
			
				-    local dirty         # 0 if dirty, 1 if clean 
			 | 
		
	
		
			
			| 
				
			 | 
			
				145
			 | 
			
			
				+    local dirty=F       # F if dirty, T if clean 
			 | 
		
	
		
			
			| 
				
			 | 
			
				146
			 | 
			
			
				+    local btime         # timestamp or nothing (see $MKIT_TTAG) 
			 | 
		
	
		
			
			| 
				143
			 | 
			
				147
			 | 
			
			
				     local suffix        # version suffix 
			 | 
		
	
		
			
			| 
				144
			 | 
			
				148
			 | 
			
			
				     prerl=$(ini 1value project:prerl) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				+    case $MKIT_TTAG in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				+        none)   btime= ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				+        btime)  btime=$(date -u +%Y%m%d%H%M%S) ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				+        ctime)  btime=$(date -d @"$(git_fact latest_cdate)" -u +%Y%m%d%H%M%S) ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				+    esac 
			 | 
		
	
		
			
			| 
				145
			 | 
			
				154
			 | 
			
			
				     grep ":" <<<"$prerl" \ 
			 | 
		
	
		
			
			| 
				146
			 | 
			
				155
			 | 
			
			
				      && warn "colon in project:prerl may corrupt version data: $prerl" 
			 | 
		
	
		
			
			| 
				147
			 | 
			
				156
			 | 
			
			
				     git_present || { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -161,14 +170,17 @@ semver() { 
			 | 
		
	
		
			
			| 
				161
			 | 
			
				170
			 | 
			
			
				     then    # we are at a later commit than the last tag 
			 | 
		
	
		
			
			| 
				162
			 | 
			
				171
			 | 
			
			
				         commit="$(git_fact current_branch).g$(git_fact latest_sha)" 
			 | 
		
	
		
			
			| 
				163
			 | 
			
				172
			 | 
			
			
				     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" ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				173
			 | 
			
			
				+    git_bool dirty && dirty=T 
			 | 
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				+    case "$dirty:$btime:$commit" in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				175
			 | 
			
			
				+        F:*:)   suffix=""                       ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				+        T::)    suffix="+dirty"                 ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				177
			 | 
			
			
				+        T:*:)   suffix="+t$btime.dirty"           ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				178
			 | 
			
			
				+        F::*)   suffix="+$commit"               ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				179
			 | 
			
			
				+        F:*:*)  suffix="+t$btime.$commit"         ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				180
			 | 
			
			
				+        T::*)   suffix="+$commit.dirty"         ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				181
			 | 
			
			
				+        T:*:*)  suffix="+t$btime.$commit.dirty"   ;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				182
			 | 
			
			
				+        *)      suffix=MKIT_BUG 
			 | 
		
	
		
			
			| 
				
			 | 
			
				183
			 | 
			
			
				+                warn "MKIT_BUG: bad dirt/commit detection" ;; 
			 | 
		
	
		
			
			| 
				172
			 | 
			
				184
			 | 
			
			
				     esac 
			 | 
		
	
		
			
			| 
				173
			 | 
			
				185
			 | 
			
			
				     test -n "$prerl" && suffix="-$prerl$suffix" 
			 | 
		
	
		
			
			| 
				174
			 | 
			
				186
			 | 
			
			
				     echo "$xyz$suffix" 
			 |