X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/c771a55e40d2a41d607a0da1b67cd1f7d546ccc8..4f8948b8f67d26726a2e53c9afe1a110c037ce4b:/setlocalversion?ds=inline

diff --git a/setlocalversion b/setlocalversion
index 43ac91a..221f868 100755
--- a/setlocalversion
+++ b/setlocalversion
@@ -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"