From 880457f83c5c05dbb54f31d294257f085abd6c58 Mon Sep 17 00:00:00 2001 From: NurPech Date: Sun, 19 May 2013 17:49:23 +0200 Subject: [PATCH] add better git version output change ctcp version output --- src/Makefile.am | 9 ++++++--- src/modcmd.c | 9 +++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 75c599a..4c20c6f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 = \ diff --git a/src/modcmd.c b/src/modcmd.c index 2ec8c6f..4f86174 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -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; } -- 2.20.1