Skip to content

Commit 9a4c97e

Browse files
committed
Merge branch 'kb/maint-prune-rmdir-closedir'
By Karsten Blees * kb/maint-prune-rmdir-closedir: fix deletion of .git/objects sub-directories in git-prune/repack
2 parents 7ac6609 + d34e70d commit 9a4c97e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

builtin/prune-packed.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
3535
unlink_or_warn(pathname);
3636
display_progress(progress, i + 1);
3737
}
38-
pathname[len] = 0;
39-
rmdir(pathname);
4038
}
4139

4240
void prune_packed_objects(int opts)
@@ -65,6 +63,8 @@ void prune_packed_objects(int opts)
6563
continue;
6664
prune_dir(i, d, pathname, len + 3, opts);
6765
closedir(d);
66+
pathname[len + 2] = '\0';
67+
rmdir(pathname);
6868
}
6969
stop_progress(&progress);
7070
}

builtin/prune.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ static int prune_dir(int i, char *path)
8585
}
8686
fprintf(stderr, "bad sha1 file: %s/%s\n", path, de->d_name);
8787
}
88+
closedir(dir);
8889
if (!show_only)
8990
rmdir(path);
90-
closedir(dir);
9191
return 0;
9292
}
9393

0 commit comments

Comments
 (0)