From: Hendrik Leppkes Date: Wed, 17 Feb 2010 00:51:21 +0000 (+0100) Subject: Special handling for genversion on win32, as the default calls don't work in all... X-Git-Tag: 0.6-rc1~45 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=3653e1882ddd26706246f58b769f6ba5b63107d8;hp=96236cf8d84711e01eef9153b229439146b4428b Special handling for genversion on win32, as the default calls don't work in all cases. 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. --- diff --git a/src/common/genversion.cpp b/src/common/genversion.cpp index 904e9718..5b8c4a1b 100644 --- a/src/common/genversion.cpp +++ b/src/common/genversion.cpp @@ -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); + #ifdef Q_OS_WIN + git.start("cmd.exe", QStringList() << "/C" << "git" << "describe" << "--long"); + #else 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 + #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"); + #endif 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"); + #endif if(git.waitForFinished(10000)) { committish = git.readAllStandardOutput().trimmed(); }