diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2015-09-27 15:42:16 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2015-09-30 10:01:44 +0000 |
commit | 7740c31746efc7eabb74ed22802f8c88711a0aba (patch) | |
tree | 188b05e7d0f6fdfd7ee6619efc998bea9610f482 | |
parent | 6dca1499ac867a3a66d5d1210918ec1f8ff0652c (diff) |
Git: Increase delay for mergetool
On Windows it takes more than 500ms to retrieve the first line.
Really wait until we have an entire line then read.
Change-Id: I9f7c222c314ea977179ed549281ef145ba756c73
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
-rw-r--r-- | src/plugins/git/mergetool.cpp | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index cc58e6ff07..6bd665c9ed 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; |