forked from qt-creator/qt-creator
Git: Fix commiting with Author and Email set
Fix commiting with Author and Email set on Windows. Task-number: QTCREATOR-2397
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user