1- use std:: process:: { Command , ExitStatus } ;
2- use std:: time:: Instant ;
1+ use std:: {
2+ process:: { Command , ExitStatus } ,
3+ time:: Instant ,
4+ } ;
35
46use anyhow:: { Context , Result , anyhow, bail} ;
57
6- use crate :: git2_ops:: GitRepo ;
7- use crate :: stats:: record_git_command;
8+ use crate :: { git2_ops:: GitRepo , stats:: record_git_command} ;
89
910pub const DEFAULT_REMOTE : & str = "origin" ;
1011
@@ -150,10 +151,10 @@ pub(crate) fn git_branch_status(
150151 let exists = git_branch_exists ( repo, branch) ;
151152 let parent_branch = match parent_branch {
152153 Some ( parent_branch) => parent_branch. to_string ( ) ,
153- None => git_remote_main ( repo, DEFAULT_REMOTE ) ?,
154+ None => repo. remote_main ( DEFAULT_REMOTE ) ?,
154155 } ;
155156 let is_descendent = exists && is_ancestor ( repo, & parent_branch, branch) ?;
156- let upstream_symbolic_name = git_get_upstream ( repo, branch) ;
157+ let upstream_symbolic_name = repo. get_upstream ( branch) ;
157158 let upstream_synced = upstream_symbolic_name
158159 . as_ref ( )
159160 . is_some_and ( |upstream| shas_match ( repo, upstream, branch) ) ;
@@ -214,8 +215,8 @@ pub(crate) struct GitTrunk {
214215 pub ( crate ) main_branch : String ,
215216}
216217
217- pub ( crate ) fn git_trunk ( repo : & GitRepo ) -> Result < GitTrunk > {
218- let remote_main = git_remote_main ( repo , DEFAULT_REMOTE ) ?;
218+ pub ( crate ) fn git_trunk ( git_repo : & GitRepo ) -> Result < GitTrunk > {
219+ let remote_main = git_repo . remote_main ( DEFAULT_REMOTE ) ?;
219220 let main_branch = after_text ( & remote_main, format ! ( "{DEFAULT_REMOTE}/" ) )
220221 . ok_or ( anyhow ! ( "no branch?" ) ) ?
221222 . to_string ( ) ;
@@ -224,12 +225,3 @@ pub(crate) fn git_trunk(repo: &GitRepo) -> Result<GitTrunk> {
224225 main_branch,
225226 } )
226227}
227-
228- /// Returns a string of the form "origin/main".
229- pub ( crate ) fn git_remote_main ( repo : & GitRepo , remote : & str ) -> Result < String > {
230- repo. remote_main ( remote)
231- }
232-
233- pub ( crate ) fn git_get_upstream ( repo : & GitRepo , branch : & str ) -> Option < String > {
234- repo. get_upstream ( branch)
235- }
0 commit comments