@matheusbsbs / matheus-bagliano / commits / 2eb53e65bd
Fork 0

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>

J. Bruce Fields committed Oct 22, 2006 at 19:01 UTC 2eb53e65bd9cdd3b76a6447a1a51dee6e5de96a3
3 files changed +8 -6
builtin-prune-packed.c
+5 -6
@@ -4,9 +4,7 @@
4 static const char prune_packed_usage[] =
5 "git-prune-packed [-n]";
6
7 -static int dryrun;
8 -
9 -static void prune_dir(int i, DIR *dir, char *pathname, int len)
7 +static void prune_dir(int i, DIR *dir, char *pathname, int len, int dryrun)
8 {
9 struct dirent *de;
10 char hex[40];
@@ -31,7 +29,7 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len)
29 rmdir(pathname);
30 }
31
34 -static void prune_packed_objects(void)
32 +void prune_packed_objects(int dryrun)
33 {
34 int i;
35 static char pathname[PATH_MAX];
@@ -50,7 +48,7 @@ static void prune_packed_objects(void)
48 d = opendir(pathname);
49 if (!d)
50 continue;
53 - prune_dir(i, d, pathname, len + 3);
51 + prune_dir(i, d, pathname, len + 3, dryrun);
52 closedir(d);
53 }
54 }
@@ -58,6 +56,7 @@ static void prune_packed_objects(void)
56 int cmd_prune_packed(int argc, const char **argv, const char *prefix)
57 {
58 int i;
59 + int dryrun;
60
61 for (i = 1; i < argc; i++) {
62 const char *arg = argv[i];
@@ -73,6 +72,6 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix)
72 usage(prune_packed_usage);
73 }
74 sync();
76 - prune_packed_objects();
75 + prune_packed_objects(dryrun);
76 return 0;
77 }
builtin-prune.c
+2
@@ -255,5 +255,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
255
256 prune_object_dir(get_object_directory());
257
258 + sync();
259 + prune_packed_objects(show_only);
260 return 0;
261 }
builtin.h
+1
@@ -11,6 +11,7 @@ extern int mailinfo(FILE *in, FILE *out, int ks, const char *encoding, const cha
11 extern int split_mbox(const char **mbox, const char *dir, int allow_bare, int nr_prec, int skip);
12 extern void stripspace(FILE *in, FILE *out);
13 extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
14 +extern void prune_packed_objects(int);
15
16 extern int cmd_add(int argc, const char **argv, const char *prefix);
17 extern int cmd_apply(int argc, const char **argv, const char *prefix);