aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@theqtcompany.com>2015-10-07 10:54:16 +0200
committerEike Ziller <eike.ziller@theqtcompany.com>2015-10-07 10:54:25 +0200
commit3286113ea8d99ed648247c13477a1beb5bc30a2c (patch)
treed00143ed07a94ff9fc077e32246e523987c6bd78 /src/plugins/git
parent022a81da7ac13e9515ee5c96f9f23f421f4ffcbe (diff)
parente548635a24b93d17ae7cc8fd8d0b6c4ac95ee1f6 (diff)
Merge remote-tracking branch 'origin/3.5'
Diffstat (limited to 'src/plugins/git')
-rw-r--r--src/plugins/git/mergetool.cpp54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp
index cc58e6ff07a..6bd665c9ed8 100644
--- a/src/plugins/git/mergetool.cpp
+++ b/src/plugins/git/mergetool.cpp
@@ -119,31 +119,35 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
MergeTool::FileState MergeTool::waitAndReadStatus(QString &extraInfo)
{
QByteArray state;
- if (m_process->canReadLine() || (m_process->waitForReadyRead(500) && m_process->canReadLine())) {
- state = m_process->readLine().trimmed();
- // " {local}: modified file"
- // " {remote}: deleted"
- if (!state.isEmpty()) {
- state = state.mid(state.indexOf(':') + 2);
- if (state == "deleted")
- return DeletedState;
- if (state.startsWith("modified"))
- return ModifiedState;
- if (state.startsWith("created"))
- return CreatedState;
- QByteArray submodulePrefix("submodule commit ");
- // " {local}: submodule commit <hash>"
- if (state.startsWith(submodulePrefix)) {
- extraInfo = QString::fromLocal8Bit(state.mid(submodulePrefix.size()));
- return SubmoduleState;
- }
- // " {local}: a symbolic link -> 'foo.cpp'"
- QByteArray symlinkPrefix("a symbolic link -> '");
- if (state.startsWith(symlinkPrefix)) {
- extraInfo = QString::fromLocal8Bit(state.mid(symlinkPrefix.size()));
- extraInfo.chop(1); // remove last quote
- return SymbolicLinkState;
- }
+ for (int i = 0; i < 5; ++i) {
+ if (m_process->canReadLine()) {
+ state = m_process->readLine().trimmed();
+ break;
+ }
+ m_process->waitForReadyRead(500);
+ }
+ // " {local}: modified file"
+ // " {remote}: deleted"
+ if (!state.isEmpty()) {
+ state = state.mid(state.indexOf(':') + 2);
+ if (state == "deleted")
+ return DeletedState;
+ if (state.startsWith("modified"))
+ return ModifiedState;
+ if (state.startsWith("created"))
+ return CreatedState;
+ QByteArray submodulePrefix("submodule commit ");
+ // " {local}: submodule commit <hash>"
+ if (state.startsWith(submodulePrefix)) {
+ extraInfo = QString::fromLocal8Bit(state.mid(submodulePrefix.size()));
+ return SubmoduleState;
+ }
+ // " {local}: a symbolic link -> 'foo.cpp'"
+ QByteArray symlinkPrefix("a symbolic link -> '");
+ if (state.startsWith(symlinkPrefix)) {
+ extraInfo = QString::fromLocal8Bit(state.mid(symlinkPrefix.size()));
+ extraInfo.chop(1); // remove last quote
+ return SymbolicLinkState;
}
}
return UnknownState;