summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@nokia.com>2010-09-24 17:23:37 +0200
committerTobias Hunger <tobias.hunger@nokia.com>2010-09-24 17:31:44 +0200
commit1613208c00408dd9592c8d5d630dbaaea5795e1a (patch)
tree05f692c1d8281cadd718f85205fc58e5de98bc10 /src
parent3f710c44980bf855956407501d42c7fdc3bd4338 (diff)
downloadqt-creator-1613208c00408dd9592c8d5d630dbaaea5795e1a.tar.gz
Git: Fix commiting with Author and Email set
Fix commiting with Author and Email set on Windows. Task-number: QTCREATOR-2397
Diffstat (limited to 'src')
-rw-r--r--src/plugins/git/clonewizardpage.cpp12
-rw-r--r--src/plugins/git/gitclient.cpp32
-rw-r--r--src/plugins/git/gitclient.h2
-rw-r--r--src/plugins/git/gitcommand.cpp14
-rw-r--r--src/plugins/git/gitcommand.h10
5 files changed, 25 insertions, 45 deletions
diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp
index 3d678210d0..504c60e283 100644
--- a/src/plugins/git/clonewizardpage.cpp
+++ b/src/plugins/git/clonewizardpage.cpp
@@ -126,9 +126,7 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob(
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;
@@ -136,7 +134,7 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob(
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
@@ -146,16 +144,16 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob(
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);
}
}
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index d957a1bc0a..48f5c5a893 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -1083,15 +1083,9 @@ GitCommand *GitClient::executeGit(const QString &workingDirectory,
}
// 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
@@ -1135,21 +1129,17 @@ Utils::SynchronousProcessResponse
{
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;
@@ -1161,16 +1151,12 @@ bool GitClient::fullySynchronousGit(const QString &workingDirectory,
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;
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 75228eaf3b..9de9844788 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -212,7 +212,7 @@ public:
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);
diff --git a/src/plugins/git/gitcommand.cpp b/src/plugins/git/gitcommand.cpp
index b681a3fcb6..f2facafa2a 100644
--- a/src/plugins/git/gitcommand.cpp
+++ b/src/plugins/git/gitcommand.cpp
@@ -68,19 +68,17 @@ GitCommand::Job::Job(const QStringList &a, int t) :
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
@@ -156,7 +154,7 @@ void GitCommand::run()
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());
diff --git a/src/plugins/git/gitcommand.h b/src/plugins/git/gitcommand.h
index 420e6f4dfa..69096c457c 100644
--- a/src/plugins/git/gitcommand.h
+++ b/src/plugins/git/gitcommand.h
@@ -54,11 +54,10 @@ public:
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();
@@ -98,7 +97,6 @@ private:
};
const QString m_binaryPath;
- QStringList m_basicArguments;
const QString m_workingDirectory;
const QProcessEnvironment m_environment;
QVariant m_cookie;