Skip to content

Commit 7685f11

Browse files
committed
fix: gpg key selection
Using only a committer's name leads to collisions if a user has multiple keys with the same name. It is now changed to use the full format, e.g.: User Name <[email protected]>
1 parent f70b27b commit 7685f11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl UserSign {
310310
let signing_key = config.get_string("user.signingkey").or_else(
311311
|_| -> Result<_, git2::Error> {
312312
let sig = repo.signature()?;
313-
Ok(String::from_utf8_lossy(sig.name_bytes()).into_owned())
313+
Ok(sig.to_string())
314314
},
315315
)?;
316316

@@ -327,7 +327,7 @@ impl UserSign {
327327
let signing_key = config.get_string("user.signingkey").or_else(
328328
|_| -> Result<_, git2::Error> {
329329
let sig = repo.signature()?;
330-
Ok(String::from_utf8_lossy(sig.name_bytes()).into_owned())
330+
Ok(sig.to_string())
331331
},
332332
)?;
333333

@@ -348,7 +348,7 @@ impl UserSign {
348348
get_default_ssh_signing_key(config)?.map(Ok).unwrap_or_else(
349349
|| -> Result<_, git2::Error> {
350350
let sig = repo.signature()?;
351-
Ok(String::from_utf8_lossy(sig.name_bytes()).into_owned())
351+
Ok(sig.to_string())
352352
},
353353
)
354354
})?;

0 commit comments

Comments
 (0)