@@ -81,8 +81,8 @@ impl<'repo> Reference<'repo> {
81
81
/// This is useful to learn where this reference is ultimately pointing to after following
82
82
/// the chain of symbolic refs and annotated tags.
83
83
///
84
- /// Note that this method mutates `self` in place if it does not already point to non-symbolic
85
- /// object.
84
+ /// Note that this method mutates `self` in place if it does not already point to a
85
+ /// non-symbolic object.
86
86
pub fn peel_to_id ( & mut self ) -> Result < Id < ' repo > , peel:: Error > {
87
87
let oid = self . inner . peel_to_id ( & self . repo . refs , & self . repo . objects ) ?;
88
88
Ok ( Id :: from_id ( oid, self . repo ) )
@@ -93,6 +93,7 @@ impl<'repo> Reference<'repo> {
93
93
///
94
94
/// This is useful to learn where this reference is ultimately pointing to after following
95
95
/// the chain of symbolic refs and annotated tags.
96
+ #[ deprecated = "Use `peel_to_id_packed()` instead" ]
96
97
pub fn peel_to_id_in_place_packed (
97
98
& mut self ,
98
99
packed : Option < & gix_ref:: packed:: Buffer > ,
@@ -103,6 +104,21 @@ impl<'repo> Reference<'repo> {
103
104
Ok ( Id :: from_id ( oid, self . repo ) )
104
105
}
105
106
107
+ /// Follow all symbolic targets this reference might point to and peel all annotated tags
108
+ /// to their first non-tag target, and return it, reusing the `packed` buffer if available.
109
+ ///
110
+ /// This is useful to learn where this reference is ultimately pointing to after following
111
+ /// the chain of symbolic refs and annotated tags.
112
+ ///
113
+ /// Note that this method mutates `self` in place if it does not already point to a
114
+ /// non-symbolic object.
115
+ pub fn peel_to_id_packed ( & mut self , packed : Option < & gix_ref:: packed:: Buffer > ) -> Result < Id < ' repo > , peel:: Error > {
116
+ let oid = self
117
+ . inner
118
+ . peel_to_id_packed ( & self . repo . refs , & self . repo . objects , packed) ?;
119
+ Ok ( Id :: from_id ( oid, self . repo ) )
120
+ }
121
+
106
122
/// Similar to [`peel_to_id()`](Reference::peel_to_id()), but consumes this instance.
107
123
pub fn into_fully_peeled_id ( mut self ) -> Result < Id < ' repo > , peel:: Error > {
108
124
self . peel_to_id ( )
@@ -112,7 +128,7 @@ impl<'repo> Reference<'repo> {
112
128
/// its type matches the given `kind`. It's an error to try to peel to a kind that this ref doesn't point to.
113
129
///
114
130
/// Note that this ref will point to the first target object afterward, which may be a tag. This is different
115
- /// from [`peel_to_id_in_place ()`](Self::peel_to_id_in_place ()) where it will point to the first non-tag object.
131
+ /// from [`peel_to_id ()`](Self::peel_to_id ()) where it will point to the first non-tag object.
116
132
///
117
133
/// Note that `git2::Reference::peel` does not "peel in place", but returns a new object
118
134
/// instead.
0 commit comments