Special handling for genversion on win32, as the default calls don't work in all...
authorHendrik Leppkes <h.leppkes@gmail.com>
Wed, 17 Feb 2010 00:51:21 +0000 (01:51 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 17 Feb 2010 14:51:59 +0000 (15:51 +0100)
The new method calls "cmd.exe /C git" and lets it resolve the path and the extension of the git executable, working in the default windows shell as well as in a mingw bash shell.

src/common/genversion.cpp

index 904e971..5b8c4a1 100644 (file)
@@ -44,19 +44,31 @@ int main(int argc, char **argv) {
     // try to execute git-describe to get a version string
     QProcess git;
     git.setWorkingDirectory(gitroot);
     // try to execute git-describe to get a version string
     QProcess git;
     git.setWorkingDirectory(gitroot);
+    #ifdef Q_OS_WIN
+    git.start("cmd.exe", QStringList() << "/C" << "git" << "describe" << "--long");
+    #else
     git.start("git", QStringList() << "describe" << "--long");
     git.start("git", QStringList() << "describe" << "--long");
+    #endif
     if(git.waitForFinished(10000)) {
       QString descr = git.readAllStandardOutput().trimmed();
       if(!descr.isEmpty() && !descr.contains("fatal")) {
         // seems we have a valid git describe string
         descrver = descr;
         // check if the workdir is dirty
     if(git.waitForFinished(10000)) {
       QString descr = git.readAllStandardOutput().trimmed();
       if(!descr.isEmpty() && !descr.contains("fatal")) {
         // seems we have a valid git describe string
         descrver = descr;
         // check if the workdir is dirty
+        #ifdef Q_OS_WIN
+        git.start("cmd.exe", QStringList() << "/C" << "git" << "diff-index" << "--name-only" << "HEAD");
+        #else
         git.start("git", QStringList() << "diff-index" << "--name-only" << "HEAD");
         git.start("git", QStringList() << "diff-index" << "--name-only" << "HEAD");
+        #endif
         if(git.waitForFinished(10000)) {
           if(!git.readAllStandardOutput().isEmpty()) dirty = "*";
         }
         // get a full committish
         if(git.waitForFinished(10000)) {
           if(!git.readAllStandardOutput().isEmpty()) dirty = "*";
         }
         // get a full committish
+        #ifdef Q_OS_WIN
+        git.start("cmd.exe", QStringList() << "/C" << "git" << "rev-parse" << "HEAD");
+        #else
         git.start("git", QStringList() << "rev-parse" << "HEAD");
         git.start("git", QStringList() << "rev-parse" << "HEAD");
+        #endif
         if(git.waitForFinished(10000)) {
           committish = git.readAllStandardOutput().trimmed();
         }
         if(git.waitForFinished(10000)) {
           committish = git.readAllStandardOutput().trimmed();
         }