From 7bd33bc247d3bc07a4e56c5ea4967dda9fbbb0ac Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 3 Aug 2022 13:07:23 +0200 Subject: [PATCH] VcsCommand: Remove defaultWorkingRepository() getter It wasn't really broadly used. Change-Id: If2e185a7d8d0f920f3ec7f507bf96dd81f4559b0 Reviewed-by: Orgad Shaneh --- src/plugins/git/gitclient.cpp | 9 +++++---- src/plugins/vcsbase/vcscommand.cpp | 7 +------ src/plugins/vcsbase/vcscommand.h | 2 -- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index de1075e7145..9342ce560ef 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -740,8 +740,9 @@ class ConflictHandler final : public QObject { Q_OBJECT public: - static void attachToCommand(VcsCommand *command, const QString &abortCommand = QString()) { - auto handler = new ConflictHandler(command->defaultWorkingDirectory(), abortCommand); + static void attachToCommand(VcsCommand *command, const FilePath &workingDirectory, + const QString &abortCommand = {}) { + auto handler = new ConflictHandler(workingDirectory, abortCommand); handler->setParent(command); // delete when command goes out of scope command->addFlags(VcsCommand::ExpectRepoChanges); @@ -3437,7 +3438,7 @@ VcsCommand *GitClient::vcsExecAbortable(const FilePath &workingDirectory, // For rebase, Git might request an editor (which means the process keeps running until the // user closes it), so run without timeout. command->addJob({vcsBinary(), arguments}, isRebase ? 0 : vcsTimeoutS()); - ConflictHandler::attachToCommand(command, abortCommand); + ConflictHandler::attachToCommand(command, workingDirectory, abortCommand); if (isRebase) GitProgressParser::attachToCommand(command); command->execute(); @@ -3500,7 +3501,7 @@ void GitClient::stashPop(const FilePath &workingDirectory, const QString &stash) arguments << stash; VcsCommand *cmd = vcsExec(workingDirectory, arguments, nullptr, true, VcsCommand::ExpectRepoChanges); - ConflictHandler::attachToCommand(cmd); + ConflictHandler::attachToCommand(cmd, workingDirectory); } bool GitClient::synchronousStashRestore(const FilePath &workingDirectory, diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp index a8bddc568a6..b96d38c313a 100644 --- a/src/plugins/vcsbase/vcscommand.cpp +++ b/src/plugins/vcsbase/vcscommand.cpp @@ -120,7 +120,7 @@ VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &envi { connect(&d->m_watcher, &QFutureWatcher::canceled, this, &VcsCommand::cancel); - VcsOutputWindow::setRepository(defaultWorkingDirectory().toString()); + VcsOutputWindow::setRepository(d->m_defaultWorkingDirectory.toString()); VcsOutputWindow *outputWindow = VcsOutputWindow::instance(); // Keep me here, just to be sure it's not instantiated in other thread connect(this, &VcsCommand::append, outputWindow, [outputWindow](const QString &t) { outputWindow->append(t); @@ -194,11 +194,6 @@ void VcsCommand::setDisplayName(const QString &name) d->m_displayName = name; } -const FilePath &VcsCommand::defaultWorkingDirectory() const -{ - return d->m_defaultWorkingDirectory; -} - void VcsCommand::addFlags(unsigned f) { d->m_flags |= f; diff --git a/src/plugins/vcsbase/vcscommand.h b/src/plugins/vcsbase/vcscommand.h index 7d817138ac2..d07fcb27556 100644 --- a/src/plugins/vcsbase/vcscommand.h +++ b/src/plugins/vcsbase/vcscommand.h @@ -124,8 +124,6 @@ public: void setDisplayName(const QString &name); - const Utils::FilePath &defaultWorkingDirectory() const; - void addJob(const Utils::CommandLine &command, int timeoutS, const Utils::FilePath &workingDirectory = {}, const Utils::ExitCodeInterpreter &interpreter = {});