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

19 lines
378 B
Rust
Raw Normal View History

2024-06-09 10:21:09 +01:00
//
use crate::newtype;
2024-06-20 19:03:11 +01:00
use derive_more::Display;
2024-06-09 10:21:09 +01:00
use crate::git::{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())
}
}