Git: Prompt for unchanged file after custom mergetool fails

To reproduce, create a conflict and configure a custom mergetool that does
nothing:

git config mergetool.my.cmd true
git config merge.tool my

Then execute merge tool from Qt Creator. The merge tool process hangs
while asking how to handle the unchanged file, and can only be killed
externally.

Change-Id: I4d2a91061bd7549e308f6a25f106e6a7afc5cadb
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2016-06-23 21:52:00 +03:00
committed by Orgad Shaneh
parent 53c4b36e4a
commit 573958e79f
2 changed files with 16 additions and 9 deletions

View File

@@ -218,6 +218,18 @@ void MergeTool::addButton(QMessageBox *msgBox, const QString &text, char key)
msgBox->addButton(text, QMessageBox::AcceptRole)->setProperty("key", key);
}
void MergeTool::prompt(const QString &title, const QString &question)
{
if (QMessageBox::question(Core::ICore::dialogParent(), title, question,
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No) == QMessageBox::Yes) {
m_process->write("y\n");
} else {
m_process->write("n\n");
}
m_process->waitForBytesWritten();
}
void MergeTool::readData()
{
while (m_process->bytesAvailable()) {
@@ -231,16 +243,10 @@ void MergeTool::readData()
m_localState = waitAndReadStatus(m_localInfo);
m_remoteState = waitAndReadStatus(m_remoteInfo);
chooseAction();
} else if (line.startsWith("Was the merge successful")) {
prompt(tr("Unchanged File"), tr("Was the merge successful?"));
} else if (line.startsWith("Continue merging")) {
if (QMessageBox::question(Core::ICore::dialogParent(), tr("Continue Merging"),
tr("Continue merging other unresolved paths?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No) == QMessageBox::Yes) {
m_process->write("y\n");
} else {
m_process->write("n\n");
}
m_process->waitForBytesWritten();
prompt(tr("Continue Merging"), tr("Continue merging other unresolved paths?"));
}
}
}

View File

@@ -64,6 +64,7 @@ public:
};
private:
void prompt(const QString &title, const QString &question);
void readData();
void done();