We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a67bb4 commit 9b2774cCopy full SHA for 9b2774c
src/info/repo.rs
@@ -148,17 +148,13 @@ impl<'a> Repo<'a> {
148
149
// This collects the repo size excluding .git
150
pub fn get_repo_size(&self) -> (String, u64) {
151
- let (repo_size, file_count) = self
152
- .repo
153
- .load_index()
154
- .transpose()
155
- .ok()
156
- .flatten()
157
- .map(|index| {
+ let (repo_size, file_count) = match self.repo.load_index() {
+ Some(Ok(index)) => {
158
let repo_size = index.entries().iter().map(|e| e.stat.size as u128).sum();
159
(repo_size, index.entries().len() as u64)
160
- })
161
- .unwrap_or_default();
+ }
+ _ => (0, 0),
+ };
162
163
(bytes_to_human_readable(repo_size), file_count)
164
}
0 commit comments