Fix commiting with Author and Email set on Windows.
Task-number: QTCREATOR-2397
const QString checkoutDir = directory();
*checkoutPath = workingDirectory + QLatin1Char('/') + checkoutDir;
- QStringList baseArgs = client->binary();
- const QString binary = baseArgs.front();
- baseArgs.pop_front();
+ const QString binary = client->binary();
QStringList args;
args << QLatin1String("clone") << repository() << checkoutDir;
VCSBase::ProcessCheckoutJob *job = new VCSBase::ProcessCheckoutJob;
const QProcessEnvironment env = client->processEnvironment();
// 1) Basic checkout step
- job->addStep(binary, baseArgs + args, workingDirectory, env);
+ job->addStep(binary, args, workingDirectory, env);
const QString checkoutBranch = branch();
// 2) Checkout branch, change to checkoutDir
args.clear();
args << QLatin1String("branch") << QLatin1String("--track")
<< checkoutBranch << (QLatin1String("origin/") + checkoutBranch);
- job->addStep(binary, baseArgs + args, *checkoutPath, env);
+ job->addStep(binary, args, *checkoutPath, env);
// Checkout branch
args.clear();
args << QLatin1String("checkout") << checkoutBranch;
- job->addStep(binary, baseArgs + args, *checkoutPath, env);
+ job->addStep(binary, args, *checkoutPath, env);
// Delete master if desired
if (deleteMasterBranch()) {
args.clear();
args << QLatin1String("branch") << QLatin1String("-D") << masterBranch;
- job->addStep(binary, baseArgs + args, *checkoutPath, env);
+ job->addStep(binary, args, *checkoutPath, env);
}
}
}
// Return fixed arguments required to run
-QStringList GitClient::binary() const
+QString GitClient::binary() const
{
-#ifdef Q_OS_WIN
- QStringList args;
- args << QLatin1String("cmd.exe") << QLatin1String("/c") << m_binaryPath;
- return args;
-#else
- return QStringList(m_binaryPath);
-#endif
+ return m_binaryPath;
}
// Determine a value for the HOME variable on Windows
{
if (Git::Constants::debug)
qDebug() << "synchronousGit" << workingDirectory << gitArguments;
- QStringList args = binary(); // "cmd /c git" on Windows
- const QString executable = args.front();
- args.pop_front();
- args.append(gitArguments);
- return VCSBase::VCSBasePlugin::runVCS(workingDirectory, executable, args,
+ return VCSBase::VCSBasePlugin::runVCS(workingDirectory, binary(), gitArguments,
m_settings.timeoutSeconds * 1000,
processEnvironment(),
flags, stdOutCodec);
}
bool GitClient::fullySynchronousGit(const QString &workingDirectory,
- const QStringList &gitArguments,
- QByteArray* outputText,
- QByteArray* errorText,
- bool logCommandToWindow)
+ const QStringList &gitArguments,
+ QByteArray* outputText,
+ QByteArray* errorText,
+ bool logCommandToWindow)
{
if (Git::Constants::debug)
qDebug() << "fullySynchronousGit" << workingDirectory << gitArguments;
process.setWorkingDirectory(workingDirectory);
process.setProcessEnvironment(processEnvironment());
- QStringList args = binary(); // "cmd /c git" on Windows
- const QString executable = args.front();
- args.pop_front();
- args.append(gitArguments);
- process.start(executable, args);
+ process.start(binary(), gitArguments);
process.closeWriteChannel();
if (!process.waitForStarted()) {
if (errorText) {
const QString msg = QString::fromLatin1("Unable to execute '%1': %2:")
- .arg(binary().join(QString(QLatin1Char(' '))), process.errorString());
+ .arg(binary(), process.errorString());
*errorText = msg.toLocal8Bit();
}
return false;
GitSettings settings() const;
void setSettings(const GitSettings &s);
- QStringList binary() const; // Executable + basic arguments
+ QString binary() const; // Executable + basic arguments
QProcessEnvironment processEnvironment() const;
static QString fakeWinHome(const QProcessEnvironment &e);
Q_UNUSED(qvMetaId)
}
-GitCommand::GitCommand(const QStringList &binary,
- const QString &workingDirectory,
- const QProcessEnvironment&environment,
- const QVariant &cookie) :
- m_binaryPath(binary.front()),
- m_basicArguments(binary),
+GitCommand::GitCommand(const QString &binary,
+ const QString &workingDirectory,
+ const QProcessEnvironment&environment,
+ const QVariant &cookie) :
+ m_binaryPath(binary),
m_workingDirectory(workingDirectory),
m_environment(environment),
m_cookie(cookie),
m_unixTerminalDisabled(false),
m_reportTerminationMode(NoReport)
{
- m_basicArguments.pop_front();
}
GitCommand::TerminationReportMode GitCommand::reportTerminationMode() const
if (Git::Constants::debug)
qDebug() << "GitCommand::run" << j << '/' << count << m_jobs.at(j).arguments;
- process->start(m_binaryPath, m_basicArguments + m_jobs.at(j).arguments);
+ process->start(m_binaryPath, m_jobs.at(j).arguments);
if(!process->waitForStarted()) {
ok = false;
error += QString::fromLatin1("Error: \"%1\" could not be started: %2").arg(m_binaryPath, process->errorString());
ReportStdout, // This assumes UTF8
ReportStderr };
- explicit GitCommand(const QStringList &binary,
- const QString &workingDirectory,
- const QProcessEnvironment &environment,
- const QVariant &cookie = QVariant());
-
+ GitCommand(const QString &binary,
+ const QString &workingDirectory,
+ const QProcessEnvironment &environment,
+ const QVariant &cookie = QVariant());
void addJob(const QStringList &arguments, int timeout);
void execute();
};
const QString m_binaryPath;
- QStringList m_basicArguments;
const QString m_workingDirectory;
const QProcessEnvironment m_environment;
QVariant m_cookie;