@@ -2,7 +2,7 @@ use crate::info::author::Author;
2
2
use crate :: info:: head_refs:: HeadRefs ;
3
3
use anyhow:: { Context , Result } ;
4
4
use byte_unit:: Byte ;
5
- use git2:: { BranchType , Repository , RepositoryOpenFlags , Status , StatusOptions , StatusShow } ;
5
+ use git2:: { Repository , RepositoryOpenFlags , Status , StatusOptions , StatusShow } ;
6
6
use git_repository as git;
7
7
use git_repository:: bstr:: ByteSlice ;
8
8
use regex:: Regex ;
@@ -50,8 +50,12 @@ impl<'a> Repo<'a> {
50
50
51
51
let mut time_of_most_recent_commit = None ;
52
52
let mut time_of_first_commit = None ;
53
- let mut ancestors = repo. head ( ) ?. peel_to_commit_in_place ( ) ?. ancestors ( ) ;
54
- let mut commit_iter = ancestors. all ( ) . peekable ( ) ;
53
+ let mut commit_iter = repo
54
+ . head ( ) ?
55
+ . peel_to_commit_in_place ( ) ?
56
+ . ancestors ( )
57
+ . all ( )
58
+ . peekable ( ) ;
55
59
56
60
let mailmap = repo. load_mailmap ( ) ;
57
61
let mut author_to_number_of_commits: HashMap < Sig , usize > = HashMap :: new ( ) ;
@@ -166,7 +170,7 @@ impl<'a> Repo<'a> {
166
170
}
167
171
168
172
pub fn get_number_of_branches ( & self ) -> Result < usize > {
169
- let mut number_of_branches = self . git2_repo . branches ( Some ( BranchType :: Remote ) ) ?. count ( ) ;
173
+ let mut number_of_branches = self . repo . references ( ) ? . remote_branches ( ) ?. count ( ) ;
170
174
if number_of_branches > 0 {
171
175
//Exclude origin/HEAD -> origin/main
172
176
number_of_branches -= 1 ;
@@ -320,8 +324,8 @@ impl<'a> Repo<'a> {
320
324
}
321
325
322
326
fn work_dir ( & self ) -> Result < & Path > {
323
- self . git2_repo
324
- . workdir ( )
327
+ self . repo
328
+ . work_dir ( )
325
329
. with_context ( || "unable to query workdir" )
326
330
}
327
331
}
0 commit comments