forked from qt-creator/qt-creator
git: Suppress stderr when running diff on Windows.
When using autocrlf, warnings "LF will be replaced by CRLF in ..." occur, causing the command window to pop up, which is not desired. Change-Id: I399080a98f9386dbbaff2c90c6d4ba4877d08057 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -83,6 +83,12 @@ static const char decorateOption[] = "--decorate";
|
|||||||
namespace Git {
|
namespace Git {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
// Suppress git diff warnings about "LF will be replaced by CRLF..." on Windows.
|
||||||
|
static inline unsigned diffExecutionFlags()
|
||||||
|
{
|
||||||
|
return Utils::HostOsInfo::isWindowsHost() ? unsigned(VcsBase::VcsBasePlugin::SuppressStdErrInLogWindow) : 0u;
|
||||||
|
}
|
||||||
|
|
||||||
using VcsBase::VcsBasePlugin;
|
using VcsBase::VcsBasePlugin;
|
||||||
|
|
||||||
class GitDiffSwitcher : public QObject
|
class GitDiffSwitcher : public QObject
|
||||||
@@ -389,6 +395,7 @@ void GitDiffHandler::collectFilesList(const QStringList &additionalArguments)
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("diff") << QLatin1String("--name-only") << additionalArguments;
|
arguments << QLatin1String("diff") << QLatin1String("--name-only") << additionalArguments;
|
||||||
command->addJob(arguments, m_timeout);
|
command->addJob(arguments, m_timeout);
|
||||||
|
command->addFlags(diffExecutionFlags());
|
||||||
command->execute();
|
command->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1186,6 +1193,7 @@ void GitClient::diff(const QString &workingDirectory,
|
|||||||
command->addJob(arguments, timeout);
|
command->addJob(arguments, timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
command->addFlags(diffExecutionFlags());
|
||||||
command->execute();
|
command->execute();
|
||||||
}
|
}
|
||||||
if (newEditor) {
|
if (newEditor) {
|
||||||
@@ -1256,7 +1264,7 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
|
|||||||
|
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
cmdArgs << QLatin1String("--") << fileName;
|
cmdArgs << QLatin1String("--") << fileName;
|
||||||
executeGit(workingDirectory, cmdArgs, vcsEditor);
|
executeGit(workingDirectory, cmdArgs, vcsEditor, false, diffExecutionFlags());
|
||||||
}
|
}
|
||||||
if (newEditor) {
|
if (newEditor) {
|
||||||
GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
|
GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
|
||||||
@@ -1315,7 +1323,7 @@ void GitClient::diffBranch(const QString &workingDirectory,
|
|||||||
<< vcsEditor->configurationWidget()->arguments()
|
<< vcsEditor->configurationWidget()->arguments()
|
||||||
<< branchName;
|
<< branchName;
|
||||||
|
|
||||||
executeGit(workingDirectory, cmdArgs, vcsEditor);
|
executeGit(workingDirectory, cmdArgs, vcsEditor, false, diffExecutionFlags());
|
||||||
}
|
}
|
||||||
if (newEditor) {
|
if (newEditor) {
|
||||||
GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
|
GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user