summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 474a90f)
raw | patch | inline | side by side (parent: 474a90f)
author | J. Bruce Fields <bfields@citi.umich.edu> | |
Sun, 22 Oct 2006 23:01:23 +0000 (19:01 -0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 22 Oct 2006 23:39:58 +0000 (16:39 -0700) |
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>
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>
builtin-prune-packed.c | patch | blob | history | |
builtin-prune.c | patch | blob | history | |
builtin.h | patch | blob | history |
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index 960db49859a286bf5f3515ee7c2bfe25fe44d09e..e12b6cf599a0b54577051e63dfce5ce0d21282cd 100644 (file)
--- a/builtin-prune-packed.c
+++ b/builtin-prune-packed.c
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];
rmdir(pathname);
}
-static void prune_packed_objects(void)
+void prune_packed_objects(int dryrun)
{
int i;
static char pathname[PATH_MAX];
d = opendir(pathname);
if (!d)
continue;
- prune_dir(i, d, pathname, len + 3);
+ prune_dir(i, d, pathname, len + 3, dryrun);
closedir(d);
}
}
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];
usage(prune_packed_usage);
}
sync();
- prune_packed_objects();
+ prune_packed_objects(dryrun);
return 0;
}
diff --git a/builtin-prune.c b/builtin-prune.c
index 6228c7907b183fb686c9f4cc54347c3dc16f3ec4..7290e6d9aa9e26cc8256a34ed22028e80936c010 100644 (file)
--- a/builtin-prune.c
+++ b/builtin-prune.c
prune_object_dir(get_object_directory());
+ sync();
+ prune_packed_objects(show_only);
return 0;
}
diff --git a/builtin.h b/builtin.h
index f9fa9ff1d245e81630438d2b321cfe04c7905905..f71b9629b9c8671dd17296fabac7e1952b3fb9e9 100644 (file)
--- a/builtin.h
+++ b/builtin.h
extern int split_mbox(const char **mbox, const char *dir, int allow_bare, int nr_prec, int skip);
extern void stripspace(FILE *in, FILE *out);
extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
+extern void prune_packed_objects(int);
extern int cmd_add(int argc, const char **argv, const char *prefix);
extern int cmd_apply(int argc, const char **argv, const char *prefix);