We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Object::peel_to_tree()
1 parent 0ac4a2c commit 0871a96Copy full SHA for 0871a96
git-repository/src/object/peel.rs
@@ -2,7 +2,7 @@
2
use crate::{
3
object,
4
object::{peel, Kind},
5
- Object,
+ Object, Tree,
6
};
7
8
///
@@ -67,6 +67,11 @@ impl<'repo> Object<'repo> {
67
}
68
69
70
+ /// Peel this object into a tree and return it, if this is possible.
71
+ pub fn peel_to_tree(self) -> Result<Tree<'repo>, peel::to_kind::Error> {
72
+ Ok(self.peel_to_kind(git_object::Kind::Tree)?.into_tree())
73
+ }
74
+
75
// TODO: tests
76
/// Follow all tag object targets until a commit, tree or blob is reached.
77
0 commit comments