Files
radicle-git/git-storage/src/signature.rs
T
Fintan Halpenny 0730453ac5 git-storage: remove owner and config
The idea of an owner came from radicle-link storing the signer in the
storage which was needed for performing signing when writing
particular rad references. The peer_id and personal identity was also
stored within the monorepo config.

Since git-storage is just general reading & writing of references and
objects, these concepts are not necessarily needed at this
level. Remove the owner from Write and remove the config module.

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

20 lines
632 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 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)
}
}