git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: prune/prune-packed
Date: Sun, 22 Oct 2006 19:14:22 -0400	[thread overview]
Message-ID: <20061022231422.GA9375@fieldses.org> (raw)
In-Reply-To: <7vy7r954k7.fsf@assigned-by-dhcp.cox.net>

On Sat, Oct 21, 2006 at 09:59:20PM -0700, Junio C Hamano wrote:
> "J. Bruce Fields" <bfields@fieldses.org> writes:
> 
> > Both "man prune" and everyday.txt say that git-prune also runs
> > git-prune-packed.  But that doesn't seem to be true.  Is the bug in the
> > documentation?
> 
> I think it is a regression when prune was rewritten as a
> built-in.

So would it be as simple as this?

--b.

>From d8a01cf8e2d4ccc02dc52fe5dd22b8462997c1ca Mon Sep 17 00:00:00 2001
From: J. Bruce Fields <bfields@citi.umich.edu>
Date: Sun, 22 Oct 2006 19:01:23 -0400
Subject: [PATCH] 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>
---
 builtin-prune-packed.c |   11 +++++------
 builtin-prune.c        |    2 ++
 builtin.h              |    1 +
 3 files changed, 8 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 @@ #include "cache.h"
 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, c
 	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 cha
 		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 6228c79..7290e6d 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -255,5 +255,7 @@ int cmd_prune(int argc, const char **arg
 
 	prune_object_dir(get_object_directory());
 
+	sync();
+	prune_packed_objects(show_only);
 	return 0;
 }
diff --git a/builtin.h b/builtin.h
index f9fa9ff..f71b962 100644
--- a/builtin.h
+++ b/builtin.h
@@ -11,6 +11,7 @@ extern int mailinfo(FILE *in, FILE *out,
 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);
-- 
1.4.3.1.g87b78

  reply	other threads:[~2006-10-22 23:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-22  3:59 prune/prune-packed J. Bruce Fields
2006-10-22  4:59 ` prune/prune-packed Junio C Hamano
2006-10-22 23:14   ` J. Bruce Fields [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-10-18 23:53 [ANNOUNCE] GIT 1.4.3 Junio C Hamano
2006-10-20 12:31 ` Horst H. von Brand
2006-10-20 13:26 ` Peter Eriksen
2006-10-20 23:35 ` Junio C Hamano
2006-10-21  0:14   ` Linus Torvalds
2006-10-21  0:22     ` Petr Baudis
2006-10-21  0:31       ` Linus Torvalds
2006-10-21  9:53       ` Andreas Schwab
2006-10-22 21:09       ` Anders Larsen
2006-10-21  2:12     ` Al Viro
2006-10-21  5:29       ` Junio C Hamano
2006-10-21  5:40         ` Al Viro
2006-10-21 14:29       ` Rene Scharfe
2006-10-21  0:47   ` Nicolas Pitre
2006-10-23  0:53   ` prune/prune-packed J. Bruce Fields
2006-10-23  1:26     ` prune/prune-packed A Large Angry SCM
2006-10-23  2:36       ` [ANNOUNCE] GIT 1.4.3 J. Bruce Fields
2006-10-23  3:27       ` prune/prune-packed Junio C Hamano
2006-10-23 18:39         ` prune/prune-packed Petr Baudis
2006-10-27 21:19         ` prune/prune-packed Jon Loeliger
2006-10-27 21:55           ` prune/prune-packed Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061022231422.GA9375@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).