Function radicle_cob::object::collaboration::parse_refstr
source ยท pub fn parse_refstr<R>(name: &R) -> Option<(TypeName, ObjectId)>
Expand description
Takes a refname
and performs a best attempt to extract out the
TypeName
and ObjectId
from it.
This assumes that the refname
is in a
git_ext::ref_format::Qualified
format. If it has any
refs/namespaces
, they will be stripped to access the underlying
git_ext::ref_format::Qualified
format.
In the git_ext::ref_format::Qualified
format it assumes that the
reference name is of the form:
refs/<category>/<typename>/<object_id>[/<rest>*]
Note that their may be more components to the path after the
ObjectId
but they are ignored.
Also note that this will return None
if:
- The
refname
is notgit_ext::ref_format::Qualified
- The parsing of the
ObjectId
fails - The parsing of the
TypeName
fails