File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 3
3
use crate :: {
4
4
object,
5
5
object:: { peel, Kind } ,
6
- Object , Tree ,
6
+ Commit , Object , Tree ,
7
7
} ;
8
8
9
9
///
@@ -69,10 +69,19 @@ impl<'repo> Object<'repo> {
69
69
}
70
70
71
71
/// 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.
72
74
pub fn peel_to_tree ( self ) -> Result < Tree < ' repo > , peel:: to_kind:: Error > {
73
75
Ok ( self . peel_to_kind ( gix_object:: Kind :: Tree ) ?. into_tree ( ) )
74
76
}
75
77
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
+
76
85
// TODO: tests
77
86
/// Follow all tag object targets until a commit, tree or blob is reached.
78
87
///
You can’t perform that action at this time.
0 commit comments