]> AND Private Git Repository - loba.git/blobdiff - setlocalversion
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Use static instead of volatile for variables that may be clobbered by a TRY..CATCH.
[loba.git] / setlocalversion
index 43ac91a1e3ea7e6656df013f97fed132f4934527..221f868a6b0a4d3ec0ef606ef991eae71caf382c 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# Inspired by linux-2.6/scripts/setlocalversion
+
 set -e
 
 FILE=localversion
@@ -11,6 +13,11 @@ compute_version()
     fi
     head=$(git rev-parse --verify --short HEAD)
     printf "~git-%s" "$head"
+    # Check for uncommitted changes
+    if git diff-index --name-only HEAD | read dummy; then
+        printf '%s' "-dirty"
+    fi
+
 }
 
 [ -f "$FILE" ] || touch "$FILE"