summaryrefslogtreecommitdiff
path: root/builtin-prune-packed.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2006-10-22 23:01:23 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-10-22 23:39:58 (GMT)
commit2eb53e65bd9cdd3b76a6447a1a51dee6e5de96a3 (patch)
tree5ed2049d3c68eeac2575f6e53edf4aa846047ee1 /builtin-prune-packed.c
parent474a90fef9ebcdedee041b2def4b9a98b94cd146 (diff)
downloadgit-2eb53e65bd9cdd3b76a6447a1a51dee6e5de96a3.zip
git-2eb53e65bd9cdd3b76a6447a1a51dee6e5de96a3.tar.gz
git-2eb53e65bd9cdd3b76a6447a1a51dee6e5de96a3.tar.bz2
Make prune also run prune-packed
Both the git-prune manpage and everday.txt say that git-prune should also prune unpacked objects that are also found in packs, by running git prune-packed. Junio thought this was "a regression when prune was rewritten as a built-in." So modify prune to call prune-packed again. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'builtin-prune-packed.c')
-rw-r--r--builtin-prune-packed.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index 960db49..e12b6cf 100644
--- a/builtin-prune-packed.c
+++ b/builtin-prune-packed.c
@@ -4,9 +4,7 @@
static const char prune_packed_usage[] =
"git-prune-packed [-n]";
-static int dryrun;
-
-static void prune_dir(int i, DIR *dir, char *pathname, int len)
+static void prune_dir(int i, DIR *dir, char *pathname, int len, int dryrun)
{
struct dirent *de;
char hex[40];
@@ -31,7 +29,7 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len)
rmdir(pathname);
}
-static void prune_packed_objects(void)
+void prune_packed_objects(int dryrun)
{
int i;
static char pathname[PATH_MAX];
@@ -50,7 +48,7 @@ static void prune_packed_objects(void)
d = opendir(pathname);
if (!d)
continue;
- prune_dir(i, d, pathname, len + 3);
+ prune_dir(i, d, pathname, len + 3, dryrun);
closedir(d);
}
}
@@ -58,6 +56,7 @@ static void prune_packed_objects(void)
int cmd_prune_packed(int argc, const char **argv, const char *prefix)
{
int i;
+ int dryrun;
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
@@ -73,6 +72,6 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix)
usage(prune_packed_usage);
}
sync();
- prune_packed_objects();
+ prune_packed_objects(dryrun);
return 0;
}