mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-11-22 02:50:40 +08:00
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>
20 lines
654 B
Rust
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)
|
|
}
|
|
}
|