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>
This commit is contained in:
Orgad Shaneh
2015-09-27 15:42:16 +03:00
committed by Orgad Shaneh
parent 6dca1499ac
commit 7740c31746

View File

@@ -119,31 +119,35 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
MergeTool::FileState MergeTool::waitAndReadStatus(QString &extraInfo) MergeTool::FileState MergeTool::waitAndReadStatus(QString &extraInfo)
{ {
QByteArray state; QByteArray state;
if (m_process->canReadLine() || (m_process->waitForReadyRead(500) && m_process->canReadLine())) { for (int i = 0; i < 5; ++i) {
state = m_process->readLine().trimmed(); if (m_process->canReadLine()) {
// " {local}: modified file" state = m_process->readLine().trimmed();
// " {remote}: deleted" break;
if (!state.isEmpty()) { }
state = state.mid(state.indexOf(':') + 2); m_process->waitForReadyRead(500);
if (state == "deleted") }
return DeletedState; // " {local}: modified file"
if (state.startsWith("modified")) // " {remote}: deleted"
return ModifiedState; if (!state.isEmpty()) {
if (state.startsWith("created")) state = state.mid(state.indexOf(':') + 2);
return CreatedState; if (state == "deleted")
QByteArray submodulePrefix("submodule commit "); return DeletedState;
// " {local}: submodule commit <hash>" if (state.startsWith("modified"))
if (state.startsWith(submodulePrefix)) { return ModifiedState;
extraInfo = QString::fromLocal8Bit(state.mid(submodulePrefix.size())); if (state.startsWith("created"))
return SubmoduleState; return CreatedState;
} QByteArray submodulePrefix("submodule commit ");
// " {local}: a symbolic link -> 'foo.cpp'" // " {local}: submodule commit <hash>"
QByteArray symlinkPrefix("a symbolic link -> '"); if (state.startsWith(submodulePrefix)) {
if (state.startsWith(symlinkPrefix)) { extraInfo = QString::fromLocal8Bit(state.mid(submodulePrefix.size()));
extraInfo = QString::fromLocal8Bit(state.mid(symlinkPrefix.size())); return SubmoduleState;
extraInfo.chop(1); // remove last quote }
return SymbolicLinkState; // " {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; return UnknownState;