Re: [PATCH] gc: make --prune useful again by accepting an optional parameter
- From
Jan Krüger <jk@jk.gs>
- Date
- Feb 14, 2009, 21:33 UTC
- Message-ID
- <3651.78.34.159.109.1234647192.squirrel@heapsort.de>
- In-Reply-To
- <alpine.DEB.1.00.0902141959060.10279@pacific.mpi-cbg.de>
Hi,
> With this patch, "git gc --no-prune" will not prune any loose (and > dangling) object, and "git gc --prune=5.minutes.ago" will prune > all loose objects older than 5 minutes.
I like it, so disregard my patch.
Show 11 quoted lines
> diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt > index 7086eea..fcef5fb 100644 > --- a/Documentation/git-gc.txt > +++ b/Documentation/git-gc.txt > @@ -8,7 +8,7 @@ git-gc - Cleanup unnecessary files and optimize the local > repository > > SYNOPSIS > -------- > -'git gc' [--aggressive] [--auto] [--quiet] > +'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date>]
Maybe add --no-prune too.
Show 11 quoted lines
> > DESCRIPTION > ----------- > @@ -59,6 +59,13 @@ are consolidated into a single pack by using the `-A` > option of > 'git-repack'. Setting `gc.autopacklimit` to 0 disables > automatic consolidation of packs. > > +--prune=<date>:: > + Prune loose objects older than date (default is 2 weeks ago). > + This option is on by default.
Maybe refer to the config option at least briefly.
Show 27 quoted lines
> +
> +--no-prune::
> + Do not prune any loose objects.
> +
> --quiet::
> Suppress all progress reports.
>
> diff --git a/builtin-gc.c b/builtin-gc.c
> index a201438..a962f38 100644
> --- a/builtin-gc.c
> +++ b/builtin-gc.c
> [snip]
> @@ -173,14 +174,15 @@ static int need_to_gc(void)
>
> int cmd_gc(int argc, const char **argv, const char *prefix)
> {
> - int prune = 0;
> int aggressive = 0;
> int auto_gc = 0;
> int quiet = 0;
> char buf[80];
>
> struct option builtin_gc_options[] = {
> - OPT_BOOLEAN(0, "prune", &prune, "prune unreferenced objects
> (deprecated)"),
> + { OPTION_STRING, 0, "prune", &prune_expire, "date",
> + "prune unreferenced objects (deprecated)",If you actually make it useful again shouldn't we stop marking it as deprecated?
-Jan