Skip to content

Commit 82124fd

Browse files
committed
🐛 fix total size loop when using with -a
1 parent ace462f commit 82124fd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/git.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ mod tests {
181181
fn check_cache(root: &Path, statuses: &HashMap<&PathBuf, GitFileStatus>, msg: &str) {
182182
let cache = GitCache::new(root);
183183
for (&path, status) in statuses.iter() {
184-
if let Ok(filename) = std::fs::canonicalize(&root.join(path)) {
184+
if let Ok(filename) = std::fs::canonicalize(root.join(path)) {
185185
let is_directory = filename.is_dir();
186186
assert_eq!(
187187
&cache.inner_get(&filename, is_directory),

src/meta/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ impl Meta {
201201
None => 0,
202202
};
203203
for x in &mut metas.iter_mut() {
204+
// must not count the size of '.' and '..', or will be infinite loop
205+
if x.name.name == "." || x.name.name == ".." {
206+
continue;
207+
}
208+
204209
x.calculate_total_size();
205210
size_accumulated += match &x.size {
206211
Some(size) => size.get_bytes(),

0 commit comments

Comments
 (0)