add better git version output
authorNurPech <nurpech@nurpech.de>
Sun, 19 May 2013 15:49:23 +0000 (17:49 +0200)
committerNurPech <nurpech@nurpech.de>
Sun, 19 May 2013 15:49:23 +0000 (17:49 +0200)
change ctcp version output

src/Makefile.am
src/modcmd.c

index 75c599ae61c32645e8ee43dc6d45a56b1c2ae9f8..4c20c6fb4844d8be78c27f028046f6c74af9fd0a 100644 (file)
@@ -27,10 +27,13 @@ git-version.c: checkversion
 
 if HAS_GIT
 checkversion:
-       @GIT_VERSION=`$(GIT) describe`; \
+       @GIT_VERSION=`$(GIT) log -n 1 --pretty="format:%h"`; \
        [ "z$$GIT_VERSION" != "z" ] || exit 0; \
        TMPFILE=`mktemp git-version.c.XXXXXX` || exit 1 ; \
-       echo "const char git_version[] = \"$${GIT_VERSION}\";" >> $$TMPFILE ; \
+       GIT_LASTCOMMIT=$$GIT_VERSION; \
+    GIT_COMMITCOUNT=`$(GIT) rev-list --all | wc -l | sed "s/[ \t]//g"`; \
+    GIT_REVISION="git-$${GIT_COMMITCOUNT}-$${GIT_LASTCOMMIT}"; \
+    echo "const char git_version[] = \"$${GIT_REVISION}\";" >> $$TMPFILE ; \
        if diff -q git-version.c $$TMPFILE >/dev/null 2>&1 ; then \
            rm $$TMPFILE ; \
         else \
@@ -40,7 +43,7 @@ checkversion:
        fi
 else
 checkversion:
-       echo "const char git_version[] = \"\";" >> git-version.c ;
+       echo "const char git_version[] = \"git-0-0\";" >> git-version.c ;
 endif
 
 EXTRA_srvx_SOURCES = \
index 2ec8c6f81cd1298c17204702460b932b687fe61f..4f861741ab0b3674c8622414cc99539c5fd9f190 100644 (file)
@@ -914,7 +914,7 @@ modcmd_privmsg(struct userNode *user, struct userNode *bot, const char *text, in
              * users, except to add copyright information pertaining
              * to changes you make to srvx.
              */
-            snprintf(response, sizeof(response), "\x01VERSION %s (%s) %s\x01", PACKAGE_STRING, CODENAME, git_version);
+            snprintf(response, sizeof(response), "\x01VERSION %s (%s) GIT Revision: %s\x01", PACKAGE_STRING, CODENAME, git_version);
             irc_notice_user(bot, user, response);
         }
         return;
@@ -1939,11 +1939,8 @@ static MODCMD_FUNC(cmd_version) {
      * command or its accessibility to normal IRC users, except to add
      * copyright information pertaining to changes you make to srvx.
      */
-    send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"$b ("CODENAME"), Built: "__DATE__", "__TIME__".  Copyright 2000-2008 srvx Development Team.");
-    if (argc > 1)
-        send_message_type(4, user, cmd->parent->bot, "%s", git_version);
-    else
-        send_message_type(12, user, cmd->parent->bot, "The srvx Development Team includes Paul Chang, Adrian Dewhurst, Miles Peterson, Michael Poole and others.\nThe srvx Development Team can be reached at http://sf.net/projects/srvx/ or in #srvx on irc.gamesurge.net.\nThis version has been modified by pk910 - visit #srvx @ irc.webgamesnet.net.");
+    send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"$b ("CODENAME"), GIT Revision: %s, Built: "__DATE__", "__TIME__".  Copyright 2000-2008 srvx Development Team.", git_version);
+    send_message_type(12, user, cmd->parent->bot, "The srvx Development Team includes Paul Chang, Adrian Dewhurst, Miles Peterson, Michael Poole and others.\nThe srvx Development Team can be reached at http://sf.net/projects/srvx/ or in #srvx on irc.gamesurge.net.\nThis version has been modified by pk910 - visit #srvx @ irc.nextirc.net.\nThis version has been modified by Stricted - visit #dev @ irc.easy-scripting.net.");
     return 1;
 }