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();
|
const QString checkoutDir = directory();
|
||||||
*checkoutPath = workingDirectory + QLatin1Char('/') + checkoutDir;
|
*checkoutPath = workingDirectory + QLatin1Char('/') + checkoutDir;
|
||||||
|
|
||||||
QStringList baseArgs = client->binary();
|
const QString binary = client->binary();
|
||||||
const QString binary = baseArgs.front();
|
|
||||||
baseArgs.pop_front();
|
|
||||||
|
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("clone") << repository() << checkoutDir;
|
args << QLatin1String("clone") << repository() << checkoutDir;
|
||||||
@@ -136,7 +134,7 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob(
|
|||||||
VCSBase::ProcessCheckoutJob *job = new VCSBase::ProcessCheckoutJob;
|
VCSBase::ProcessCheckoutJob *job = new VCSBase::ProcessCheckoutJob;
|
||||||
const QProcessEnvironment env = client->processEnvironment();
|
const QProcessEnvironment env = client->processEnvironment();
|
||||||
// 1) Basic checkout step
|
// 1) Basic checkout step
|
||||||
job->addStep(binary, baseArgs + args, workingDirectory, env);
|
job->addStep(binary, args, workingDirectory, env);
|
||||||
const QString checkoutBranch = branch();
|
const QString checkoutBranch = branch();
|
||||||
|
|
||||||
// 2) Checkout branch, change to checkoutDir
|
// 2) Checkout branch, change to checkoutDir
|
||||||
@@ -146,16 +144,16 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob(
|
|||||||
args.clear();
|
args.clear();
|
||||||
args << QLatin1String("branch") << QLatin1String("--track")
|
args << QLatin1String("branch") << QLatin1String("--track")
|
||||||
<< checkoutBranch << (QLatin1String("origin/") + checkoutBranch);
|
<< checkoutBranch << (QLatin1String("origin/") + checkoutBranch);
|
||||||
job->addStep(binary, baseArgs + args, *checkoutPath, env);
|
job->addStep(binary, args, *checkoutPath, env);
|
||||||
// Checkout branch
|
// Checkout branch
|
||||||
args.clear();
|
args.clear();
|
||||||
args << QLatin1String("checkout") << checkoutBranch;
|
args << QLatin1String("checkout") << checkoutBranch;
|
||||||
job->addStep(binary, baseArgs + args, *checkoutPath, env);
|
job->addStep(binary, args, *checkoutPath, env);
|
||||||
// Delete master if desired
|
// Delete master if desired
|
||||||
if (deleteMasterBranch()) {
|
if (deleteMasterBranch()) {
|
||||||
args.clear();
|
args.clear();
|
||||||
args << QLatin1String("branch") << QLatin1String("-D") << masterBranch;
|
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
|
// Return fixed arguments required to run
|
||||||
QStringList GitClient::binary() const
|
QString GitClient::binary() const
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
return m_binaryPath;
|
||||||
QStringList args;
|
|
||||||
args << QLatin1String("cmd.exe") << QLatin1String("/c") << m_binaryPath;
|
|
||||||
return args;
|
|
||||||
#else
|
|
||||||
return QStringList(m_binaryPath);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine a value for the HOME variable on Windows
|
// Determine a value for the HOME variable on Windows
|
||||||
@@ -1135,11 +1129,7 @@ Utils::SynchronousProcessResponse
|
|||||||
{
|
{
|
||||||
if (Git::Constants::debug)
|
if (Git::Constants::debug)
|
||||||
qDebug() << "synchronousGit" << workingDirectory << gitArguments;
|
qDebug() << "synchronousGit" << workingDirectory << gitArguments;
|
||||||
QStringList args = binary(); // "cmd /c git" on Windows
|
return VCSBase::VCSBasePlugin::runVCS(workingDirectory, binary(), gitArguments,
|
||||||
const QString executable = args.front();
|
|
||||||
args.pop_front();
|
|
||||||
args.append(gitArguments);
|
|
||||||
return VCSBase::VCSBasePlugin::runVCS(workingDirectory, executable, args,
|
|
||||||
m_settings.timeoutSeconds * 1000,
|
m_settings.timeoutSeconds * 1000,
|
||||||
processEnvironment(),
|
processEnvironment(),
|
||||||
flags, stdOutCodec);
|
flags, stdOutCodec);
|
||||||
@@ -1161,16 +1151,12 @@ bool GitClient::fullySynchronousGit(const QString &workingDirectory,
|
|||||||
process.setWorkingDirectory(workingDirectory);
|
process.setWorkingDirectory(workingDirectory);
|
||||||
process.setProcessEnvironment(processEnvironment());
|
process.setProcessEnvironment(processEnvironment());
|
||||||
|
|
||||||
QStringList args = binary(); // "cmd /c git" on Windows
|
process.start(binary(), gitArguments);
|
||||||
const QString executable = args.front();
|
|
||||||
args.pop_front();
|
|
||||||
args.append(gitArguments);
|
|
||||||
process.start(executable, args);
|
|
||||||
process.closeWriteChannel();
|
process.closeWriteChannel();
|
||||||
if (!process.waitForStarted()) {
|
if (!process.waitForStarted()) {
|
||||||
if (errorText) {
|
if (errorText) {
|
||||||
const QString msg = QString::fromLatin1("Unable to execute '%1': %2:")
|
const QString msg = QString::fromLatin1("Unable to execute '%1': %2:")
|
||||||
.arg(binary().join(QString(QLatin1Char(' '))), process.errorString());
|
.arg(binary(), process.errorString());
|
||||||
*errorText = msg.toLocal8Bit();
|
*errorText = msg.toLocal8Bit();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ public:
|
|||||||
GitSettings settings() const;
|
GitSettings settings() const;
|
||||||
void setSettings(const GitSettings &s);
|
void setSettings(const GitSettings &s);
|
||||||
|
|
||||||
QStringList binary() const; // Executable + basic arguments
|
QString binary() const; // Executable + basic arguments
|
||||||
QProcessEnvironment processEnvironment() const;
|
QProcessEnvironment processEnvironment() const;
|
||||||
static QString fakeWinHome(const QProcessEnvironment &e);
|
static QString fakeWinHome(const QProcessEnvironment &e);
|
||||||
|
|
||||||
|
|||||||
@@ -68,19 +68,17 @@ GitCommand::Job::Job(const QStringList &a, int t) :
|
|||||||
Q_UNUSED(qvMetaId)
|
Q_UNUSED(qvMetaId)
|
||||||
}
|
}
|
||||||
|
|
||||||
GitCommand::GitCommand(const QStringList &binary,
|
GitCommand::GitCommand(const QString &binary,
|
||||||
const QString &workingDirectory,
|
const QString &workingDirectory,
|
||||||
const QProcessEnvironment&environment,
|
const QProcessEnvironment&environment,
|
||||||
const QVariant &cookie) :
|
const QVariant &cookie) :
|
||||||
m_binaryPath(binary.front()),
|
m_binaryPath(binary),
|
||||||
m_basicArguments(binary),
|
|
||||||
m_workingDirectory(workingDirectory),
|
m_workingDirectory(workingDirectory),
|
||||||
m_environment(environment),
|
m_environment(environment),
|
||||||
m_cookie(cookie),
|
m_cookie(cookie),
|
||||||
m_unixTerminalDisabled(false),
|
m_unixTerminalDisabled(false),
|
||||||
m_reportTerminationMode(NoReport)
|
m_reportTerminationMode(NoReport)
|
||||||
{
|
{
|
||||||
m_basicArguments.pop_front();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GitCommand::TerminationReportMode GitCommand::reportTerminationMode() const
|
GitCommand::TerminationReportMode GitCommand::reportTerminationMode() const
|
||||||
@@ -156,7 +154,7 @@ void GitCommand::run()
|
|||||||
if (Git::Constants::debug)
|
if (Git::Constants::debug)
|
||||||
qDebug() << "GitCommand::run" << j << '/' << count << m_jobs.at(j).arguments;
|
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()) {
|
if(!process->waitForStarted()) {
|
||||||
ok = false;
|
ok = false;
|
||||||
error += QString::fromLatin1("Error: \"%1\" could not be started: %2").arg(m_binaryPath, process->errorString());
|
error += QString::fromLatin1("Error: \"%1\" could not be started: %2").arg(m_binaryPath, process->errorString());
|
||||||
|
|||||||
@@ -54,12 +54,11 @@ public:
|
|||||||
ReportStdout, // This assumes UTF8
|
ReportStdout, // This assumes UTF8
|
||||||
ReportStderr };
|
ReportStderr };
|
||||||
|
|
||||||
explicit GitCommand(const QStringList &binary,
|
GitCommand(const QString &binary,
|
||||||
const QString &workingDirectory,
|
const QString &workingDirectory,
|
||||||
const QProcessEnvironment &environment,
|
const QProcessEnvironment &environment,
|
||||||
const QVariant &cookie = QVariant());
|
const QVariant &cookie = QVariant());
|
||||||
|
|
||||||
|
|
||||||
void addJob(const QStringList &arguments, int timeout);
|
void addJob(const QStringList &arguments, int timeout);
|
||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
@@ -98,7 +97,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
const QString m_binaryPath;
|
const QString m_binaryPath;
|
||||||
QStringList m_basicArguments;
|
|
||||||
const QString m_workingDirectory;
|
const QString m_workingDirectory;
|
||||||
const QProcessEnvironment m_environment;
|
const QProcessEnvironment m_environment;
|
||||||
QVariant m_cookie;
|
QVariant m_cookie;
|
||||||
|
|||||||
Reference in New Issue
Block a user