Skip to content

Commit 06bbc99

Browse files
committed
wip(external-ssh-signer): add support for signer program config
1 parent 27e28d5 commit 06bbc99

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

asyncgit/src/sync/sign.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ impl SignBuilder {
156156
String::from("x509"),
157157
)),
158158
"ssh" => {
159+
let program = config
160+
.get_string("gpg.ssh.program")
161+
.unwrap_or_else(|_| "ssh-keygen".to_string());
159162
let ssh_signer = config
160163
.get_string("user.signingKey")
161164
.ok()
@@ -178,7 +181,7 @@ impl SignBuilder {
178181
"ssh key setting absent",
179182
))
180183
})
181-
.and_then(SSHSign::new)?;
184+
.and_then(|key_path| SSHSign::new(program, key_path))?;
182185
let signer: Box<dyn Sign> = Box::new(ssh_signer);
183186
Ok(signer)
184187
}
@@ -282,7 +285,7 @@ pub struct SSHSign {
282285

283286
impl SSHSign {
284287
/// Create new [`SSHDiskKeySign`] for sign.
285-
pub fn new(mut key: PathBuf) -> Result<Self, SignBuilderError> {
288+
pub fn new(program: String, mut key: PathBuf) -> Result<Self, SignBuilderError> {
286289
key.set_extension("");
287290
if key.is_file() {
288291
#[cfg(test)]
@@ -294,7 +297,7 @@ impl SSHSign {
294297
})
295298
.map(|secret_key| Self {
296299
#[cfg(test)]
297-
program: "ssh".to_string(),
300+
program,
298301
#[cfg(test)]
299302
key_path,
300303
secret_key,

0 commit comments

Comments
 (0)