Files
radicle-git/git-storage/src/signature.rs
T
Fintan Halpenny e6f36318cd git-storage: port storage from librad
This provides a port of the librad::git::storage[0] API, with a focus
on being more generic and decomposing writing and reading
operations. It also takes heavy inspiration from
link_replication::io::refdb[1] for its implementation of the
transactional writes.

[0]: https://github.com/radicle-dev/radicle-link/blob/master/librad/src/git/storage.rs
[1]: https://github.com/radicle-dev/radicle-link/blob/master/link-replication/src/io/refdb.rs

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-09-27 12:32:20 +01:00

20 lines
654 B
Rust

// Copyright © 2022 The Radicle Link Contributors
// SPDX-License-Identifier: GPL-3.0-or-later
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct UserInfo {
/// Provided `name` of the user.
pub name: String,
/// Proivded `email` of the user. Note that this does not necessarily have
/// to be an email, but will be used as the email field in [`crate::config`]
/// and the [`git2::Signature`].
pub email: String,
}
impl UserInfo {
/// Obtain the [`git2::Signature`] for this `UserInfo`.
pub fn signature(&self) -> Result<git2::Signature, git2::Error> {
git2::Signature::now(&self.name, &self.email)
}
}