VcsBase: Remove some ssh related methods

Remove VcsCommand::m_sshPrompt, as it is always taken
from settings.

Change-Id: I9f46bb5a9de03e907f2098ca72a647c969e55a27
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-07-12 12:45:36 +02:00
parent 975baf23ac
commit cea7be0486
4 changed files with 6 additions and 24 deletions

View File

@@ -725,17 +725,6 @@ FilePath findRepositoryForFile(const FilePath &fileOrDir, const QString &checkFi
return {}; return {};
} }
// Is SSH prompt configured?
QString sshPrompt()
{
return Internal::VcsPlugin::instance()->settings().sshPasswordPrompt.value();
}
bool isSshPromptConfigured()
{
return !sshPrompt().isEmpty();
}
static const char SOURCE_PROPERTY[] = "qtcreator_source"; static const char SOURCE_PROPERTY[] = "qtcreator_source";
void setSource(IDocument *document, const QString &source) void setSource(IDocument *document, const QString &source)
@@ -749,14 +738,15 @@ QString source(IDocument *document)
return document->property(SOURCE_PROPERTY).toString(); return document->property(SOURCE_PROPERTY).toString();
} }
void setProcessEnvironment(Environment *e, bool forceCLocale, const QString &sshPromptBinary) void setProcessEnvironment(Environment *e, bool forceCLocale)
{ {
if (forceCLocale) { if (forceCLocale) {
e->set("LANG", "C"); e->set("LANG", "C");
e->set("LANGUAGE", "C"); e->set("LANGUAGE", "C");
} }
if (!sshPromptBinary.isEmpty()) const QString prompt = Internal::VcsPlugin::instance()->settings().sshPasswordPrompt.value();
e->set("SSH_ASKPASS", sshPromptBinary); if (!prompt.isEmpty())
e->set("SSH_ASKPASS", prompt);
} }
} // namespace VcsBase } // namespace VcsBase

View File

@@ -126,18 +126,12 @@ private:
VCSBASE_EXPORT Utils::FilePath findRepositoryForFile(const Utils::FilePath &fileOrDir, VCSBASE_EXPORT Utils::FilePath findRepositoryForFile(const Utils::FilePath &fileOrDir,
const QString &checkFile); const QString &checkFile);
// Returns SSH prompt configured in settings.
VCSBASE_EXPORT QString sshPrompt();
// Returns whether an SSH prompt is configured.
VCSBASE_EXPORT bool isSshPromptConfigured();
// Set up the environment for a version control command line call. // Set up the environment for a version control command line call.
// Sets up SSH graphical password prompting (note that the latter // Sets up SSH graphical password prompting (note that the latter
// requires a terminal-less process) and sets LANG to 'C' to force English // requires a terminal-less process) and sets LANG to 'C' to force English
// (suppress LOCALE warnings/parse commands output) if desired. // (suppress LOCALE warnings/parse commands output) if desired.
VCSBASE_EXPORT void setProcessEnvironment(Utils::Environment *e, VCSBASE_EXPORT void setProcessEnvironment(Utils::Environment *e,
bool forceCLocale, bool forceCLocale);
const QString &sshPasswordPrompt = sshPrompt());
// Sets the source of editor contents, can be directory or file. // Sets the source of editor contents, can be directory or file.
VCSBASE_EXPORT void setSource(Core::IDocument *document, const QString &source); VCSBASE_EXPORT void setSource(Core::IDocument *document, const QString &source);
// Returns the source of editor contents. // Returns the source of editor contents.

View File

@@ -55,7 +55,6 @@ VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &envi
VcsOutputWindow::setRepository(workingDirectory.toString()); VcsOutputWindow::setRepository(workingDirectory.toString());
setDisableUnixTerminal(); setDisableUnixTerminal();
m_sshPrompt = VcsBase::sshPrompt();
connect(this, &VcsCommand::started, this, [this] { connect(this, &VcsCommand::started, this, [this] {
if (flags() & ExpectRepoChanges) if (flags() & ExpectRepoChanges)
@@ -79,7 +78,7 @@ VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &envi
Environment VcsCommand::environment() const Environment VcsCommand::environment() const
{ {
Environment env = ShellCommand::environment(); Environment env = ShellCommand::environment();
VcsBase::setProcessEnvironment(&env, flags() & ForceCLocale, m_sshPrompt); VcsBase::setProcessEnvironment(&env, flags() & ForceCLocale);
return env; return env;
} }

View File

@@ -60,7 +60,6 @@ private:
void emitRepositoryChanged(const Utils::FilePath &workingDirectory); void emitRepositoryChanged(const Utils::FilePath &workingDirectory);
QPointer<Core::FutureProgress> m_progress; QPointer<Core::FutureProgress> m_progress;
QString m_sshPrompt;
bool m_preventRepositoryChanged; bool m_preventRepositoryChanged;
}; };