Commit 59592c82 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

VCS: Do not force LANG=C on all commands.

Introduce extra flag.

Task-number: QTCREATORBUG-1623
parent ff7c543a
......@@ -1085,7 +1085,7 @@ QProcessEnvironment GitClient::processEnvironment() const
if (m_settings.adoptPath)
environment.insert(QLatin1String("PATH"), m_settings.path);
// Set up SSH and C locale (required by git using perl).
VCSBase::VCSBasePlugin::setProcessEnvironment(&environment);
VCSBase::VCSBasePlugin::setProcessEnvironment(&environment, false);
return environment;
}
......
......@@ -72,7 +72,7 @@ ProcessCheckoutJobPrivate::ProcessCheckoutJobPrivate(const QString &b,
{
if (!workingDirectory.isEmpty())
process->setWorkingDirectory(workingDirectory);
VCSBasePlugin::setProcessEnvironment(&processEnv);
VCSBasePlugin::setProcessEnvironment(&processEnv, false);
process->setProcessEnvironment(processEnv);
}
......
......@@ -686,8 +686,9 @@ bool VCSBasePlugin::isSshPromptConfigured()
return !sshPrompt().isEmpty();
}
void VCSBasePlugin::setProcessEnvironment(QProcessEnvironment *e)
void VCSBasePlugin::setProcessEnvironment(QProcessEnvironment *e, bool forceCLocale)
{
if (forceCLocale)
e->insert(QLatin1String("LANG"), QString(QLatin1Char('C')));
const QString sshPromptBinary = sshPrompt();
if (!sshPromptBinary.isEmpty())
......@@ -738,6 +739,8 @@ Utils::SynchronousProcessResponse
nsp << "ssh (" << sshPromptConfigured << ')';
if (flags & SuppressCommandLogging)
nsp << "suppress_log";
if (flags & ForceCLocale)
nsp << "c_locale";
if (outputCodec)
nsp << " Codec: " << outputCodec->name();
}
......@@ -747,7 +750,7 @@ Utils::SynchronousProcessResponse
if (!workingDir.isEmpty())
process.setWorkingDirectory(workingDir);
VCSBase::VCSBasePlugin::setProcessEnvironment(&env);
VCSBase::VCSBasePlugin::setProcessEnvironment(&env, (flags & ForceCLocale));
process.setProcessEnvironment(env);
process.setTimeout(timeOutMS);
if (outputCodec)
......
......@@ -176,10 +176,10 @@ public:
static QString findRepositoryForDirectory(const QString &dir, const QString &checkFile);
// Set up the environment for a version control command line call.
// Sets LANG to 'C' to force English (suppress LOCALE warnings)
// and sets up SSH graphical password prompting (note that the latter
// requires a terminal-less process).
static void setProcessEnvironment(QProcessEnvironment *e);
// Sets up SSH graphical password prompting (note that the latter
// requires a terminal-less process) and sets LANG to 'C' to force English
// (suppress LOCALE warnings/parse commands output) if desired.
static void setProcessEnvironment(QProcessEnvironment *e, bool forceCLocale);
// Returns whether an SSH prompt is configured.
static bool isSshPromptConfigured();
......@@ -191,7 +191,8 @@ public:
SuppressStdErrInLogWindow = 0x8, // No standard error output to VCS output window.
SuppressFailMessageInLogWindow = 0x10, // No message VCS about failure in VCS output window.
SuppressCommandLogging = 0x20, // No command log entry in VCS output window.
ShowSuccessMessage = 0x40 // Show message about successful completion in VCS output window.
ShowSuccessMessage = 0x40, // Show message about successful completion in VCS output window.
ForceCLocale = 0x80 // Force C-locale for commands whose output is parsed.
};
static Utils::SynchronousProcessResponse
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment