1
0
Fork 0

Merging upstream version 0.5.8.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-25 09:57:50 +02:00
parent 0b173dae8e
commit b2b58aaf60
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
9 changed files with 19 additions and 18 deletions

View file

@ -47,7 +47,7 @@ pub enum Error {
AskpassExitStatus(AskpassExitStatusError),
/// Password contains invalid UTF-8.
InvalidUtf8(std::string::FromUtf8Error),
InvalidUtf8,
/// Failed to open a handle to the main terminal of the process.
OpenTerminal(std::io::Error),
@ -153,7 +153,7 @@ fn askpass_prompt(program: &Path, prompt: &str) -> Result<String, Error> {
.map_err(Error::AskpassCommand)?;
if output.status.success() {
let password = String::from_utf8(output.stdout)
.map_err(Error::InvalidUtf8)?;
.map_err(|_| Error::InvalidUtf8)?;
Ok(password)
} else {
// Do not keep stdout, it could contain a password D:
@ -169,7 +169,7 @@ impl std::fmt::Display for Error {
match self {
Self::AskpassCommand(e) => write!(f, "Failed to run askpass command: {e}"),
Self::AskpassExitStatus(e) => write!(f, "{e}"),
Self::InvalidUtf8(_) => write!(f, "User response contains invalid UTF-8"),
Self::InvalidUtf8 => write!(f, "User response contains invalid UTF-8"),
Self::OpenTerminal(e) => write!(f, "Failed to open terminal: {e}"),
Self::ReadWriteTerminal(e) => write!(f, "Failed to read/write to terminal: {e}"),
}

View file

@ -349,7 +349,7 @@ impl GitAuthenticator {
let candidates = [
"id_rsa",
"id_ecdsa,",
"id_ecdsa",
"id_ecdsa_sk",
"id_ed25519",
"id_ed25519_sk",
@ -615,6 +615,9 @@ impl PrivateKeyFile {
None
},
Ok(key_info) => {
if key_info.format == ssh_key::KeyFormat::Unknown {
warn!("Unknown key format for key: {}", self.private_key.display());
}
if key_info.encrypted {
prompter.prompt_ssh_key_passphrase(&self.private_key, git_config)
} else {

View file

@ -33,9 +33,6 @@ pub(crate) trait ClonePrompter: Prompter {
/// Clone the `Box<dyn ClonePrompter>`.
fn dyn_clone(&self) -> Box<dyn ClonePrompter>;
/// Get `self` as plain `Prompter`.
fn as_prompter(&self) -> &dyn Prompter;
/// Get `self` as plain `Prompter`.
fn as_prompter_mut(&mut self) -> &mut dyn Prompter;
}
@ -49,10 +46,6 @@ where
Box::new(self.clone())
}
fn as_prompter(&self) -> &dyn Prompter {
self
}
fn as_prompter_mut(&mut self) -> &mut dyn Prompter {
self
}

View file

@ -22,6 +22,7 @@ pub enum Error {
}
/// The format of a key file.
#[derive(Copy, Clone, Eq, PartialEq)]
pub enum KeyFormat {
/// We don't know what format it is.
Unknown,