git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C Hamano
Message 17 of 17 in “Documentation: pruning recipe for destructive filter-branch”
  1. Documentation: pruning recipe for destructive filter-branchThomas Rast, Feb 13, 2009
  2. Junio C HamanoFeb 14, 2009
  3. Jan KrügerFeb 14, 2009
  4. Johannes SchindelinFeb 14, 2009
  5. Jan KrügerFeb 14, 2009
  6. Johannes SchindelinFeb 14, 2009
  7. Documentation: pruning recipe for destructive filter-branchThomas Rast, Feb 14, 2009
  8. Johannes SchindelinFeb 14, 2009
  9. Junio C HamanoFeb 14, 2009
  10. Documentation: pruning recipe for destructive filter-branchThomas Rast, Feb 14, 2009
  11. gc: make --prune useful again by accepting an optional parameterJohannes Schindelin, Feb 14, 2009
  12. Thomas RastFeb 14, 2009
  13. Johannes SchindelinFeb 14, 2009
  14. gc: make --prune useful again by accepting an optional parameterJohannes Schindelin, Feb 14, 2009
  15. Thomas RastFeb 14, 2009
  16. Junio C HamanoFeb 15, 2009
  17. Jan KrügerFeb 14, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.