git-next/crates/git/src/git_ref.rs

19 lines
381 B
Rust
Raw Normal View History

2024-06-09 10:21:09 +01:00
//
use git_next_core::newtype;
2024-06-20 19:03:11 +01:00
use derive_more::Display;
2024-06-09 10:21:09 +01:00
use crate::{commit::Sha, Commit};
newtype!(GitRef: String, Display: "A git reference to a git commit.");
impl From<Commit> for GitRef {
fn from(value: Commit) -> Self {
Self(value.sha().to_string())
}
}
impl From<Sha> for GitRef {
fn from(value: Sha) -> Self {
2024-06-09 10:21:09 +01:00
Self(value.to_string())
}
}