Enum git_protocol::handshake::Ref
source · pub enum Ref {
Peeled {
full_ref_name: BString,
tag: ObjectId,
object: ObjectId,
},
Direct {
full_ref_name: BString,
object: ObjectId,
},
Symbolic {
full_ref_name: BString,
target: BString,
object: ObjectId,
},
Unborn {
full_ref_name: BString,
target: BString,
},
}blocking-client or async-client only.Expand description
A git reference, commonly referred to as ‘ref’, as returned by a git server before sending a pack.
Variants
Peeled
Fields
full_ref_name: BStringThe name at which the ref is located, like refs/tags/1.0.
tag: ObjectIdThe hash of the tag the ref points to.
object: ObjectIdThe hash of the object the tag points to.
A ref pointing to a tag object, which in turns points to an object, usually a commit
Direct
Fields
full_ref_name: BStringThe name at which the ref is located, like refs/heads/main.
object: ObjectIdThe hash of the object the ref points to.
A ref pointing to a commit object
Symbolic
Fields
full_ref_name: BStringThe name at which the symbolic ref is located, like HEAD.
target: BStringThe path of the ref the symbolic ref points to, like refs/heads/main.
See issue #205 for details
object: ObjectIdThe hash of the object the target ref points to.
A symbolic ref pointing to target ref, which in turn points to an object
Unborn
Fields
full_ref_name: BStringThe name at which the ref is located, typically HEAD.
target: BStringThe path of the ref the symbolic ref points to, like refs/heads/main, even though the target does not yet exist.
A ref is unborn on the remote and just points to the initial, unborn branch, as is the case in a newly initialized repository or dangling symbolic refs.
Implementations
sourceimpl Ref
impl Ref
sourcepub fn unpack(&self) -> (&BStr, Option<&oid>, Option<&oid>)
pub fn unpack(&self) -> (&BStr, Option<&oid>, Option<&oid>)
Provide shared fields referring to the ref itself, namely (name, target, [peeled]).
In case of peeled refs, the tag object itself is returned as it is what the ref directly refers to, and target of the tag is returned
as peeled.
If unborn, the first object id will be the null oid.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Ref
impl<'de> Deserialize<'de> for Ref
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl Ord for Ref
impl Ord for Ref
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialOrd<Ref> for Ref
impl PartialOrd<Ref> for Ref
sourcefn partial_cmp(&self, other: &Ref) -> Option<Ordering>
fn partial_cmp(&self, other: &Ref) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more