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 {};
}
// 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";
void setSource(IDocument *document, const QString &source)
@@ -749,14 +738,15 @@ QString source(IDocument *document)
return document->property(SOURCE_PROPERTY).toString();
}
void setProcessEnvironment(Environment *e, bool forceCLocale, const QString &sshPromptBinary)
void setProcessEnvironment(Environment *e, bool forceCLocale)
{
if (forceCLocale) {
e->set("LANG", "C");
e->set("LANGUAGE", "C");
}
if (!sshPromptBinary.isEmpty())
e->set("SSH_ASKPASS", sshPromptBinary);
const QString prompt = Internal::VcsPlugin::instance()->settings().sshPasswordPrompt.value();
if (!prompt.isEmpty())
e->set("SSH_ASKPASS", prompt);
}
} // namespace VcsBase

View File

@@ -126,18 +126,12 @@ private:
VCSBASE_EXPORT Utils::FilePath findRepositoryForFile(const Utils::FilePath &fileOrDir,
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.
// Sets up SSH graphical password prompting (note that the latter
// requires a terminal-less process) and sets LANG to 'C' to force English
// (suppress LOCALE warnings/parse commands output) if desired.
VCSBASE_EXPORT void setProcessEnvironment(Utils::Environment *e,
bool forceCLocale,
const QString &sshPasswordPrompt = sshPrompt());
bool forceCLocale);
// Sets the source of editor contents, can be directory or file.
VCSBASE_EXPORT void setSource(Core::IDocument *document, const QString &source);
// Returns the source of editor contents.

View File

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

View File

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