File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 33use crate :: {
44 object,
55 object:: { peel, Kind } ,
6- Object , Tree ,
6+ Commit , Object , Tree ,
77} ;
88
99///
@@ -69,10 +69,19 @@ impl<'repo> Object<'repo> {
6969 }
7070
7171 /// Peel this object into a tree and return it, if this is possible.
72+ ///
73+ /// This will follow tag objects and commits until their tree is reached.
7274 pub fn peel_to_tree ( self ) -> Result < Tree < ' repo > , peel:: to_kind:: Error > {
7375 Ok ( self . peel_to_kind ( gix_object:: Kind :: Tree ) ?. into_tree ( ) )
7476 }
7577
78+ /// Peel this object into a commit and return it, if this is possible.
79+ ///
80+ /// This will follow tag objects until a commit is reached.
81+ pub fn peel_to_commit ( self ) -> Result < Commit < ' repo > , peel:: to_kind:: Error > {
82+ Ok ( self . peel_to_kind ( gix_object:: Kind :: Commit ) ?. into_commit ( ) )
83+ }
84+
7685 // TODO: tests
7786 /// Follow all tag object targets until a commit, tree or blob is reached.
7887 ///
You can’t perform that action at this time.
0 commit comments