diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2018-11-14 11:12:57 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2018-11-14 13:37:49 +0000 |
commit | 2f41f359526c5452b981e002acd935fc3cec4014 (patch) | |
tree | 0bdf743cff435eb013928230bf5326d5f7e2bbad | |
parent | b8dcaa455e8b8139634a1992a30b11295d627378 (diff) | |
download | qt-creator-2f41f359526c5452b981e002acd935fc3cec4014.tar.gz |
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>
-rw-r--r-- | src/libs/utils/shellcommand.cpp | 7 | ||||
-rw-r--r-- | src/libs/utils/shellcommand.h | 1 | ||||
-rw-r--r-- | src/plugins/git/gitclient.cpp | 3 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index 92d97dc65b..0d5be90996 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -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? diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index c1bdb5a785..22ff4a8df2 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -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 }; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index ad7cd7ca17..56577ffd8d 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -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)); |