forked from qt-creator/qt-creator
Git: Make commit a bit less synchronous
If gc.auto is configured, commit can trigger garbage collection, which takes time. Avoid completely blocking the UI on this case, and at least show the output of the commit command. Change-Id: Id301c878c26599bbc363928a6770c04369a62f2f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
b8dcaa455e
commit
2f41f35952
@@ -338,10 +338,13 @@ SynchronousProcessResponse ShellCommand::runCommand(const FileName &binary,
|
||||
if (!(d->m_flags & SuppressCommandLogging))
|
||||
proxy->appendCommand(dir, binary, arguments);
|
||||
|
||||
if (d->m_flags & FullySynchronously || QThread::currentThread() == QCoreApplication::instance()->thread())
|
||||
if ((d->m_flags & FullySynchronously)
|
||||
|| (!(d->m_flags & NoFullySync)
|
||||
&& QThread::currentThread() == QCoreApplication::instance()->thread())) {
|
||||
response = runFullySynchronous(binary, arguments, proxy, timeoutS, dir, interpreter);
|
||||
else
|
||||
} else {
|
||||
response = runSynchronous(binary, arguments, proxy, timeoutS, dir, interpreter);
|
||||
}
|
||||
|
||||
if (!d->m_aborted) {
|
||||
// Success/Fail message in appropriate window?
|
||||
|
@@ -101,6 +101,7 @@ public:
|
||||
FullySynchronously = 0x80, // Suppress local event loop (in case UI actions are
|
||||
// triggered by file watchers).
|
||||
SilentOutput = 0x100, // Suppress user notifications about the output happening.
|
||||
NoFullySync = 0x200, // Avoid fully synchronous execution even in UI thread.
|
||||
NoOutput = SuppressStdErr | SuppressFailMessage | SuppressCommandLogging
|
||||
};
|
||||
|
||||
|
@@ -2721,7 +2721,8 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
||||
arguments << "--signoff";
|
||||
}
|
||||
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(repositoryDirectory, arguments);
|
||||
const SynchronousProcessResponse resp = vcsSynchronousExec(repositoryDirectory, arguments,
|
||||
VcsCommand::NoFullySync);
|
||||
const QString stdErr = resp.stdErr();
|
||||
if (resp.result == SynchronousProcessResponse::Finished) {
|
||||
VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount));
|
||||
|
Reference in New Issue
Block a user