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
This commit is contained in:
Junio C Hamano
2012-03-08 13:05:04 -08:00
2 changed files with 3 additions and 3 deletions

View File

@ -35,8 +35,6 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
unlink_or_warn(pathname); unlink_or_warn(pathname);
display_progress(progress, i + 1); display_progress(progress, i + 1);
} }
pathname[len] = 0;
rmdir(pathname);
} }
void prune_packed_objects(int opts) void prune_packed_objects(int opts)
@ -65,6 +63,8 @@ void prune_packed_objects(int opts)
continue; continue;
prune_dir(i, d, pathname, len + 3, opts); prune_dir(i, d, pathname, len + 3, opts);
closedir(d); closedir(d);
pathname[len + 2] = '\0';
rmdir(pathname);
} }
stop_progress(&progress); stop_progress(&progress);
} }

View File

@ -85,9 +85,9 @@ static int prune_dir(int i, char *path)
} }
fprintf(stderr, "bad sha1 file: %s/%s\n", path, de->d_name); fprintf(stderr, "bad sha1 file: %s/%s\n", path, de->d_name);
} }
closedir(dir);
if (!show_only) if (!show_only)
rmdir(path); rmdir(path);
closedir(dir);
return 0; return 0;
} }