@@ -26,7 +26,6 @@ pub struct Commits {
26
26
pub struct Repo < ' a > {
27
27
git2_repo : & ' a Repository ,
28
28
repo : git:: Repository ,
29
- commits : Commits ,
30
29
}
31
30
32
31
#[ derive( Hash , PartialOrd , Ord , Eq , PartialEq ) ]
@@ -127,59 +126,42 @@ impl Commits {
127
126
time_of_most_recent_commit,
128
127
} )
129
128
}
130
- }
131
-
132
- impl < ' a > Repo < ' a > {
133
- pub fn new (
134
- git2_repo : & ' a Repository ,
135
- no_merges : bool ,
136
- bot_regex_pattern : & Option < Regex > ,
137
- number_of_authors_to_display : usize ,
138
- ) -> Result < Self > {
139
- let repo = git:: open ( git2_repo. path ( ) ) ?;
140
- let commits = Commits :: new (
141
- repo. clone ( ) ,
142
- no_merges,
143
- bot_regex_pattern,
144
- number_of_authors_to_display,
145
- ) ?;
146
-
147
- Ok ( Self {
148
- repo,
149
- git2_repo,
150
- commits,
151
- } )
152
- }
153
129
154
130
pub fn get_creation_date ( & self , iso_time : bool ) -> String {
155
- gitoxide_time_to_formatted_time ( self . commits . time_of_first_commit , iso_time)
131
+ gitoxide_time_to_formatted_time ( self . time_of_first_commit , iso_time)
156
132
}
157
133
158
- pub fn get_number_of_commits ( & self ) -> String {
134
+ pub fn count ( & self ) -> String {
159
135
format ! (
160
136
"{}{}" ,
161
- self . commits. num_commits,
162
- self . commits
163
- . is_shallow
164
- . then( || " (shallow)" )
165
- . unwrap_or_default( )
137
+ self . num_commits,
138
+ self . is_shallow. then( || " (shallow)" ) . unwrap_or_default( )
166
139
)
167
140
}
168
141
169
142
pub fn take_authors ( & mut self , show_email : bool ) -> ( Vec < Author > , usize ) {
170
143
if !show_email {
171
- for author in & mut self . commits . authors {
144
+ for author in & mut self . authors {
172
145
author. clear_email ( ) ;
173
146
}
174
147
}
175
- (
176
- std:: mem:: take ( & mut self . commits . authors ) ,
177
- self . commits . total_num_authors ,
178
- )
148
+ ( std:: mem:: take ( & mut self . authors ) , self . total_num_authors )
179
149
}
180
150
181
151
pub fn get_date_of_last_commit ( & self , iso_time : bool ) -> String {
182
- gitoxide_time_to_formatted_time ( self . commits . time_of_most_recent_commit , iso_time)
152
+ gitoxide_time_to_formatted_time ( self . time_of_most_recent_commit , iso_time)
153
+ }
154
+ }
155
+
156
+ impl < ' a > Repo < ' a > {
157
+ pub fn new ( git2_repo : & ' a Repository ) -> Result < Self > {
158
+ let repo = git:: open ( git2_repo. path ( ) ) ?;
159
+
160
+ Ok ( Self { repo, git2_repo } )
161
+ }
162
+
163
+ pub fn gitoxide ( & self ) -> git:: Repository {
164
+ self . repo . clone ( )
183
165
}
184
166
185
167
// This collects the repo size excluding .git
0 commit comments