Merge branch 'development'
[NeonServV5.git] / src / version.sh
old mode 100644 (file)
new mode 100755 (executable)
index 27b7589..1e64d41
@@ -20,18 +20,29 @@ else \
 codelines=`find . -type f -regex '\./.*\.h' -or -regex '\./.*\.c' |xargs cat|wc -l`
 
 
-git_revision=`git rev-list -n 1 --pretty="format:%h" --header master | grep '^[0-9a-f]*$'`
-if test "x$git_revision" = "x" ; then
+git_revision_id=`git rev-list -n 1 --pretty="format:%h" --header refs/heads/master | grep '^[0-9a-f]*$'`
+if test "x$git_revision_id" = "x" ; then
   git_revision="0"
   git_commitcount="0"
+  git_is_stable="1"
+  git_dev_rev=""
 else
-  git_commitcount=`git rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"`
-  git_revision="git-$git_commitcount-$svn_revision"
+  git_commitcount=`git rev-list --oneline --first-parent refs/heads/master | wc -l | sed "s/[ \t]//g"`
+  git_revision="git-$git_revision_id"
+  
+  git_real_revision_id=`git rev-list -n 1 --pretty="format:%h" --header HEAD | grep '^[0-9a-f]*$'`
+  if test "$git_revision_id" = "$git_real_revision_id" ; then
+    git_is_stable="1"
+    git_dev_rev=""
+  else
+    git_is_stable="0"
+    git_dev_rev="git-$git_real_revision_id"
+  fi
 fi
 
 
 /bin/cat > version.c <<!SUB!THIS!
-/* version.c - NeonServ v5.5
+/* version.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -55,6 +66,8 @@ const char *compilation = "$compilation";
 const char *creation = "$creation";
 const char *revision = "$git_revision";
 const char *codelines = "$codelines";
+const int revision_master = $git_is_stable;
+const char *dev_revision = "$git_dev_rev";
 
 const int patchlevel = ($git_commitcount ? ($git_commitcount - VERSION_PATCHLEVEL) : 0);
 
@@ -74,6 +87,14 @@ const char *get_codelines() {
     return codelines;
 }
 
+const int is_stable_revision() {
+    return revision_master;
+}
+
+const char *get_dev_revision() {
+    return dev_revision;
+}
+
 const int get_patchlevel() {
     return patchlevel;
 }