pub struct Reference {
pub name: RefName,
pub target: Target,
}Expand description
A full reference name and its stored target, without symbolic resolution or tag peeling.
Use this owned result for display or subsequent conditional operations. Enumeration order is stable in the returned vector, but filesystem traversal is not one repository-wide instant; preserve an expected value when acting on it.
use girt::refs::{Expected, RefName, Target};
use girt::{InitKind, ObjectFormat, Repository};
let directory = tempfile::tempdir()?;
let repo = Repository::init(
ObjectFormat::Sha1,
directory.path().join("r.git"),
InitKind::Bare,
)?;
let id = repo.loose_objects().write_blob(b"tagged manifest")?;
let refs = repo.references()?;
let name = RefName::new("refs/tags/one")?;
refs.update_without_reflog(&name, Target::Direct(id), Expected::Absent)?;
let listed = refs.list()?;
assert_eq!(listed[0].name, name);
assert_eq!(listed[0].target, Target::Direct(id));Fields§
§name: RefNameExact reference-name bytes; enumeration excludes pseudorefs such as HEAD.
target: TargetEffective backend value. Symbolic targets may be missing or cyclic.
Trait Implementations§
impl Eq for Reference
impl StructuralPartialEq for Reference
Auto Trait Implementations§
impl Freeze for Reference
impl RefUnwindSafe for Reference
impl Send for Reference
impl Sync for Reference
impl Unpin for Reference
impl UnsafeUnpin for Reference
impl UnwindSafe for Reference
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more