VcsCommand: Remove m_preventRepositoryChanged field

Disconnect the appropriate connection instead.

Change-Id: Ie5cd8b3bcbab526aa770c493a465c9cdb07437f6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-07-14 10:18:27 +02:00
parent b1e46d735f
commit cb9ead8c8d
2 changed files with 10 additions and 12 deletions

View File

@@ -43,19 +43,13 @@ using namespace Utils;
namespace VcsBase {
VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &environment) :
ShellCommand(workingDirectory, environment),
m_preventRepositoryChanged(false)
VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &environment)
: ShellCommand(workingDirectory, environment)
{
Environment env = environment;
VcsBase::setProcessEnvironment(&env);
setEnvironment(env);
connect(ICore::instance(), &ICore::coreAboutToClose, this, [this] {
m_preventRepositoryChanged = true;
abort();
});
VcsOutputWindow::setRepository(workingDirectory.toString());
setDisableUnixTerminal();
@@ -78,7 +72,13 @@ VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &envi
connect(this, &ShellCommand::appendMessage, outputWindow, &VcsOutputWindow::appendMessage);
connect(this, &ShellCommand::executedAsync, this, &VcsCommand::addTask);
connect(this, &ShellCommand::runCommandFinished, this, &VcsCommand::postRunCommand);
const auto connection = connect(this, &ShellCommand::runCommandFinished,
this, &VcsCommand::postRunCommand);
connect(ICore::instance(), &ICore::coreAboutToClose, this, [this, connection] {
disconnect(connection);
abort();
});
}
void VcsCommand::addTask(const QFuture<void> &future)
@@ -110,7 +110,7 @@ void VcsCommand::addTask(const QFuture<void> &future)
void VcsCommand::postRunCommand(const FilePath &workingDirectory)
{
if (m_preventRepositoryChanged || !(flags() & ShellCommand::ExpectRepoChanges))
if (!(flags() & ShellCommand::ExpectRepoChanges))
return;
// TODO tell the document manager that the directory now received all expected changes
// Core::DocumentManager::unexpectDirectoryChange(d->m_workingDirectory);

View File

@@ -40,8 +40,6 @@ private:
void addTask(const QFuture<void> &future);
void postRunCommand(const Utils::FilePath &workDirectory);
bool m_preventRepositoryChanged;
friend class VcsBaseClientImpl;
};