This crate provides ways of identifying an actor within the git repository both in shared and mutable variants.
Examples
use gix_actor::{IdentityRef, SignatureRef};
let actor = IdentityRef::from_bytes::<()>(b" Taylor Example < taylor@example.com >")
.unwrap()
.trim();
assert_eq!(actor.name, "Taylor Example");
assert_eq!(actor.email, "taylor@example.com");
let signature = SignatureRef::from_bytes::<()>(b"Taylor Example <taylor@example.com> 1711398853 +0800")
.unwrap()
.trim();
assert_eq!(signature.actor(), actor);
let time = signature.time().unwrap();
assert_eq!(time.seconds, 1_711_398_853);
assert_eq!(time.offset, 8 * 60 * 60);
let owned = signature.to_owned().unwrap();
let mut out = Vec::new();
owned.write_to(&mut out).unwrap();
assert_eq!(out, b"Taylor Example <taylor@example.com> 1711398853 +0800");
Feature Flags