summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-03-08 13:05:04 -0800
committerJunio C Hamano <gitster@pobox.com>2012-03-08 13:05:04 -0800
commit9a4c97eb8923879f240c35c778eeb52ac7e9476e (patch)
treecc19a1bd8083eba8468030b0243ef94b8b35fbbf /builtin
parent7ac6609d9afde0d56705842fd60abb41715c1d1e (diff)
parentd34e70d6b89b33c398403e872c0dd751d44c7844 (diff)
downloadgit-9a4c97eb8923879f240c35c778eeb52ac7e9476e.tar.gz
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
Diffstat (limited to 'builtin')
-rw-r--r--builtin/prune-packed.c4
-rw-r--r--builtin/prune.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c
index f9463deec2..b58a2e1eb2 100644
--- a/builtin/prune-packed.c
+++ b/builtin/prune-packed.c
@@ -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)
@@ -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);
}
diff --git a/builtin/prune.c b/builtin/prune.c
index 58d7cb8324..b99b635e44 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -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;
}