summaryrefslogtreecommitdiff
path: root/src/plugins/git/gitclient.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-11-28 11:09:44 +0100
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2013-11-28 13:41:52 +0100
commit6ec8838f688d3b41c2e4d450d85a0bb8990d2f38 (patch)
tree025671d4a1f707293cdd041776086385a33bb92c /src/plugins/git/gitclient.cpp
parent6c02c27e9e5891440dc99565e4dee01618a76d5e (diff)
downloadqt-creator-6ec8838f688d3b41c2e4d450d85a0bb8990d2f38.tar.gz
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>
Diffstat (limited to 'src/plugins/git/gitclient.cpp')
-rw-r--r--src/plugins/git/gitclient.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index ac1f8b497c..22d8076a3c 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -83,6 +83,12 @@ static const char decorateOption[] = "--decorate";
namespace Git {
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;
class GitDiffSwitcher : public QObject
@@ -389,6 +395,7 @@ void GitDiffHandler::collectFilesList(const QStringList &additionalArguments)
QStringList arguments;
arguments << QLatin1String("diff") << QLatin1String("--name-only") << additionalArguments;
command->addJob(arguments, m_timeout);
+ command->addFlags(diffExecutionFlags());
command->execute();
}
@@ -1186,6 +1193,7 @@ void GitClient::diff(const QString &workingDirectory,
command->addJob(arguments, timeout);
}
}
+ command->addFlags(diffExecutionFlags());
command->execute();
}
if (newEditor) {
@@ -1256,7 +1264,7 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
if (!fileName.isEmpty())
cmdArgs << QLatin1String("--") << fileName;
- executeGit(workingDirectory, cmdArgs, vcsEditor);
+ executeGit(workingDirectory, cmdArgs, vcsEditor, false, diffExecutionFlags());
}
if (newEditor) {
GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
@@ -1315,7 +1323,7 @@ void GitClient::diffBranch(const QString &workingDirectory,
<< vcsEditor->configurationWidget()->arguments()
<< branchName;
- executeGit(workingDirectory, cmdArgs, vcsEditor);
+ executeGit(workingDirectory, cmdArgs, vcsEditor, false, diffExecutionFlags());
}
if (newEditor) {
GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);