@@ -81,8 +81,8 @@ impl<'repo> Reference<'repo> {
8181 /// This is useful to learn where this reference is ultimately pointing to after following
8282 /// the chain of symbolic refs and annotated tags.
8383 ///
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.
8686 pub fn peel_to_id ( & mut self ) -> Result < Id < ' repo > , peel:: Error > {
8787 let oid = self . inner . peel_to_id ( & self . repo . refs , & self . repo . objects ) ?;
8888 Ok ( Id :: from_id ( oid, self . repo ) )
@@ -93,6 +93,7 @@ impl<'repo> Reference<'repo> {
9393 ///
9494 /// This is useful to learn where this reference is ultimately pointing to after following
9595 /// the chain of symbolic refs and annotated tags.
96+ #[ deprecated = "Use `peel_to_id_packed()` instead" ]
9697 pub fn peel_to_id_in_place_packed (
9798 & mut self ,
9899 packed : Option < & gix_ref:: packed:: Buffer > ,
@@ -103,6 +104,21 @@ impl<'repo> Reference<'repo> {
103104 Ok ( Id :: from_id ( oid, self . repo ) )
104105 }
105106
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+
106122 /// Similar to [`peel_to_id()`](Reference::peel_to_id()), but consumes this instance.
107123 pub fn into_fully_peeled_id ( mut self ) -> Result < Id < ' repo > , peel:: Error > {
108124 self . peel_to_id ( )
@@ -112,7 +128,7 @@ impl<'repo> Reference<'repo> {
112128 /// its type matches the given `kind`. It's an error to try to peel to a kind that this ref doesn't point to.
113129 ///
114130 /// 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.
116132 ///
117133 /// Note that `git2::Reference::peel` does not "peel in place", but returns a new object
118134 /// instead.
0 commit comments