Skip to content

Commit

Permalink
Merge branch 'kb/maint-prune-rmdir-closedir'
Browse files Browse the repository at this point in the history
By Karsten Blees
* kb/maint-prune-rmdir-closedir:
  fix deletion of .git/objects sub-directories in git-prune/repack
  • Loading branch information
Junio C Hamano committed Mar 8, 2012
2 parents 7ac6609 + d34e70d commit 9a4c97e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions builtin/prune-packed.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
unlink_or_warn(pathname);
display_progress(progress, i + 1);
}
pathname[len] = 0;
rmdir(pathname);
}

void prune_packed_objects(int opts)
Expand Down Expand Up @@ -65,6 +63,8 @@ void prune_packed_objects(int opts)
continue;
prune_dir(i, d, pathname, len + 3, opts);
closedir(d);
pathname[len + 2] = '\0';
rmdir(pathname);
}
stop_progress(&progress);
}
Expand Down
2 changes: 1 addition & 1 deletion builtin/prune.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ static int prune_dir(int i, char *path)
}
fprintf(stderr, "bad sha1 file: %s/%s\n", path, de->d_name);
}
closedir(dir);
if (!show_only)
rmdir(path);
closedir(dir);
return 0;
}

Expand Down

0 comments on commit 9a4c97e

Please sign in to comment.