From 60d75393df5205791eb33f58921973f16c27c770 Mon Sep 17 00:00:00 2001
From: Dimitris Lampridis <dimitris.lampridis@cern.ch>
Date: Fri, 27 Jul 2018 14:44:45 +0200
Subject: [PATCH] tools: mark dirty commits as such in sdb_desc_gen.tcl

---
 tools/sdb_desc_gen.tcl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/sdb_desc_gen.tcl b/tools/sdb_desc_gen.tcl
index f8c7c6b6..96721ff1 100644
--- a/tools/sdb_desc_gen.tcl
+++ b/tools/sdb_desc_gen.tcl
@@ -123,6 +123,9 @@ if { [catch { set inf_commit_id [exec git log -1 --format=%H] }] } {
 if { [catch { set inf_repo_url [exec git config --get remote.origin.url] }] } {
     set inf_repo_url "unknown url"
 }
+if { [catch { set dirty_repo [exec git describe --all --dirty | grep -c dirty] }] } {
+    set dirty_repo "0"
+}
 
 #-------------------------------------------------------------------------------
 # STEP 5/7: Generate the output file
@@ -151,7 +154,11 @@ puts $fp "package synthesis_descriptor is"
 puts $fp ""
 puts $fp "  constant c_sdb_synthesis_info : t_sdb_synthesis := ("
 puts $fp "    syn_module_name  => \"[str_procrustes $inf_project 16]\","
-puts $fp "    syn_commit_id    => \"[str_procrustes $inf_commit_id 32]\","
+if {$dirty_repo == "0"} {
+    puts $fp "    syn_commit_id    => \"[str_procrustes $inf_commit_id 32]\","
+} else {
+    puts $fp "    syn_commit_id    => \"[str_procrustes $inf_commit_id 31]*\","
+}
 puts $fp "    syn_tool_name    => \"[str_procrustes $inf_tool_name 8]\","
 puts $fp "    syn_tool_version => x\"$inf_tool_version\","
 puts $fp "    syn_date         => x\"[str_procrustes $inf_date_ymd 8]\","
-- 
GitLab