@@ -123,7 +123,7 @@ impl GitRemote {
123123
124124            let  resolved_commit_hash = match  locked_rev { 
125125                Some ( rev)  => db. contains ( rev) . then_some ( rev) , 
126-                 None  => reference . resolve ( & db. repo ) . ok ( ) , 
126+                 None  => resolve_ref ( reference ,   & db. repo ) . ok ( ) , 
127127            } ; 
128128            if  let  Some ( rev)  = resolved_commit_hash { 
129129                return  Ok ( ( db,  rev) ) ; 
@@ -148,7 +148,7 @@ impl GitRemote {
148148        . with_context ( || format ! ( "failed to clone into: {}" ,  into. display( ) ) ) ?; 
149149        let  rev = match  locked_rev { 
150150            Some ( rev)  => rev, 
151-             None  => reference . resolve ( & repo) ?, 
151+             None  => resolve_ref ( reference ,   & repo) ?, 
152152        } ; 
153153
154154        Ok ( ( 
@@ -207,56 +207,54 @@ impl GitDatabase {
207207        self . repo . revparse_single ( & oid. to_string ( ) ) . is_ok ( ) 
208208    } 
209209
210-     /// [`GitReference::resolve `]s this reference with this database. 
210+     /// [`resolve_ref `]s this reference with this database. 
211211     pub  fn  resolve ( & self ,  r :  & GitReference )  -> CargoResult < git2:: Oid >  { 
212-         r . resolve ( & self . repo ) 
212+         resolve_ref ( r ,   & self . repo ) 
213213    } 
214214} 
215215
216- impl  GitReference  { 
217-     /// Resolves self to an object ID with objects the `repo` currently has. 
218-      pub  fn  resolve ( & self ,  repo :  & git2:: Repository )  -> CargoResult < git2:: Oid >  { 
219-         let  id = match  self  { 
220-             // Note that we resolve the named tag here in sync with where it's 
221-             // fetched into via `fetch` below. 
222-             GitReference :: Tag ( s)  => ( || -> CargoResult < git2:: Oid >  { 
223-                 let  refname = format ! ( "refs/remotes/origin/tags/{}" ,  s) ; 
224-                 let  id = repo. refname_to_id ( & refname) ?; 
225-                 let  obj = repo. find_object ( id,  None ) ?; 
226-                 let  obj = obj. peel ( ObjectType :: Commit ) ?; 
227-                 Ok ( obj. id ( ) ) 
228-             } ) ( ) 
229-             . with_context ( || format ! ( "failed to find tag `{}`" ,  s) ) ?, 
230- 
231-             // Resolve the remote name since that's all we're configuring in 
232-             // `fetch` below. 
233-             GitReference :: Branch ( s)  => { 
234-                 let  name = format ! ( "origin/{}" ,  s) ; 
235-                 let  b = repo
236-                     . find_branch ( & name,  git2:: BranchType :: Remote ) 
237-                     . with_context ( || format ! ( "failed to find branch `{}`" ,  s) ) ?; 
238-                 b. get ( ) 
239-                     . target ( ) 
240-                     . ok_or_else ( || anyhow:: format_err!( "branch `{}` did not have a target" ,  s) ) ?
241-             } 
216+ /// Resolves self to an object ID with objects the `repo` currently has. 
217+ pub  fn  resolve_ref ( gitref :  & GitReference ,  repo :  & git2:: Repository )  -> CargoResult < git2:: Oid >  { 
218+     let  id = match  gitref { 
219+         // Note that we resolve the named tag here in sync with where it's 
220+         // fetched into via `fetch` below. 
221+         GitReference :: Tag ( s)  => ( || -> CargoResult < git2:: Oid >  { 
222+             let  refname = format ! ( "refs/remotes/origin/tags/{}" ,  s) ; 
223+             let  id = repo. refname_to_id ( & refname) ?; 
224+             let  obj = repo. find_object ( id,  None ) ?; 
225+             let  obj = obj. peel ( ObjectType :: Commit ) ?; 
226+             Ok ( obj. id ( ) ) 
227+         } ) ( ) 
228+         . with_context ( || format ! ( "failed to find tag `{}`" ,  s) ) ?, 
229+ 
230+         // Resolve the remote name since that's all we're configuring in 
231+         // `fetch` below. 
232+         GitReference :: Branch ( s)  => { 
233+             let  name = format ! ( "origin/{}" ,  s) ; 
234+             let  b = repo
235+                 . find_branch ( & name,  git2:: BranchType :: Remote ) 
236+                 . with_context ( || format ! ( "failed to find branch `{}`" ,  s) ) ?; 
237+             b. get ( ) 
238+                 . target ( ) 
239+                 . ok_or_else ( || anyhow:: format_err!( "branch `{}` did not have a target" ,  s) ) ?
240+         } 
242241
243-              // We'll be using the HEAD commit 
244-              GitReference :: DefaultBranch  => { 
245-                  let  head_id = repo. refname_to_id ( "refs/remotes/origin/HEAD" ) ?; 
246-                  let  head = repo. find_object ( head_id,  None ) ?; 
247-                  head. peel ( ObjectType :: Commit ) ?. id ( ) 
248-              } 
242+         // We'll be using the HEAD commit 
243+         GitReference :: DefaultBranch  => { 
244+             let  head_id = repo. refname_to_id ( "refs/remotes/origin/HEAD" ) ?; 
245+             let  head = repo. find_object ( head_id,  None ) ?; 
246+             head. peel ( ObjectType :: Commit ) ?. id ( ) 
247+         } 
249248
250-             GitReference :: Rev ( s)  => { 
251-                 let  obj = repo. revparse_single ( s) ?; 
252-                 match  obj. as_tag ( )  { 
253-                     Some ( tag)  => tag. target_id ( ) , 
254-                     None  => obj. id ( ) , 
255-                 } 
249+         GitReference :: Rev ( s)  => { 
250+             let  obj = repo. revparse_single ( s) ?; 
251+             match  obj. as_tag ( )  { 
252+                 Some ( tag)  => tag. target_id ( ) , 
253+                 None  => obj. id ( ) , 
256254            } 
257-         } ; 
258-          Ok ( id ) 
259-     } 
255+         } 
256+     } ; 
257+     Ok ( id ) 
260258} 
261259
262260impl < ' a >  GitCheckout < ' a >  { 
@@ -1404,7 +1402,7 @@ fn github_fast_path(
14041402        return  Ok ( FastPathRev :: Indeterminate ) ; 
14051403    } 
14061404
1407-     let  local_object = reference . resolve ( repo) . ok ( ) ; 
1405+     let  local_object = resolve_ref ( reference ,   repo) . ok ( ) ; 
14081406
14091407    let  github_branch_name = match  reference { 
14101408        GitReference :: Branch ( branch)  => branch, 
0 commit comments