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

Re: [PATCH] receive-pack: run "gc --auto" and optionally "update-server-info"

From
Nicolas Pitre <nico@fluxnic.net>
Date
Oct 21, 2009, 00:21 UTC
Message-ID
<alpine.LFD.2.00.0910202009560.21460@xanadu.home>
In-Reply-To
<7vljj5lofb.fsf_-_@alter.siamese.dyndns.org>
On Tue, 20 Oct 2009, Junio C Hamano wrote:
Show 6 quoted lines
> Introduce two new configuration variables, receive.autogc (defaults to
> true) and receive.updateserverinfo (defaults to false).  When these are
> set, receive-pack runs "gc --auto" and "update-server-info" respectively
> after it finishes receiving data from "git push" and updating refs.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Show 97 quoted lines
> ---
> 
>   Nicolas Pitre <nico@fluxnic.net> writes:
> 
>   > On Tue, 20 Oct 2009, Junio C Hamano wrote:
>   >
>   >> Nicolas Pitre <nico@fluxnic.net> writes:
>   >> 
>   >> > Still... Hopefully this is going to become redundant information in the 
>   >> > future with the eventual deployment of smart protocol over HTTP.  So I 
>   >> > think that as a config option being off by default this is a good 
>   >> > compromize.  Site administrators can turn it on by default in 
>   >> > /etc/gitconfig.
>   >> 
>   >> Ok, something like this?
>   >
>   > Looks fine to me, except...
> 
>   Everything you said sounded sensible.  Thanks.
> 
>  Documentation/config.txt |    9 +++++++++
>  builtin-receive-pack.c   |   18 ++++++++++++++++++
>  2 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index cd17814..ba6ed10 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1320,6 +1320,11 @@ rebase.stat::
>  	Whether to show a diffstat of what changed upstream since the last
>  	rebase. False by default.
>  
> +receive.autogc::
> +	By default, git-receive-pack will run "git-gc --auto" after
> +	receiving data from git-push and updating refs.  You can stop
> +	it by setting this variable to false.
> +
>  receive.fsckObjects::
>  	If it is set to true, git-receive-pack will check all received
>  	objects. It will abort in the case of a malformed object or a
> @@ -1355,6 +1360,10 @@ receive.denyNonFastForwards::
>  	even if that push is forced. This configuration variable is
>  	set when initializing a shared repository.
>  
> +receive.updateserverinfo::
> +	If set to true, git-receive-pack will run git-update-server-info
> +	after receiving data from git-push and updating refs.
> +
>  remote.<name>.url::
>  	The URL of a remote repository.  See linkgit:git-fetch[1] or
>  	linkgit:git-push[1].
> diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c
> index b771fe9..92173ac 100644
> --- a/builtin-receive-pack.c
> +++ b/builtin-receive-pack.c
> @@ -28,6 +28,8 @@ static int transfer_unpack_limit = -1;
>  static int unpack_limit = 100;
>  static int report_status;
>  static int prefer_ofs_delta = 1;
> +static int auto_update_server_info;
> +static int auto_gc = 1;
>  static const char *head_name;
>  static char *capabilities_to_send;
>  
> @@ -88,6 +90,16 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
>  		return 0;
>  	}
>  
> +	if (strcmp(var, "receive.updateserverinfo") == 0) {
> +		auto_update_server_info = git_config_bool(var, value);
> +		return 0;
> +	}
> +
> +	if (strcmp(var, "receive.autogc") == 0) {
> +		auto_gc = git_config_bool(var, value);
> +		return 0;
> +	}
> +
>  	return git_default_config(var, value, cb);
>  }
>  
> @@ -672,6 +684,12 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
>  			report(unpack_status);
>  		run_receive_hook(post_receive_hook);
>  		run_update_post_hook(commands);
> +		if (auto_gc) {
> +			const char *argv_gc_auto[] = { "gc", "--auto", NULL };
> +			run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
> +		}
> +		if (auto_update_server_info)
> +			update_server_info(0);
>  	}
>  	return 0;
>  }
> -- 
> 1.6.5.1.107.gba912
> 
Previous: Junio C HamanoNext: Johannes Sixt
Message 9 of 18 in “git gc and kernel.org”
  1. H. Peter AnvinOct 20, 2009
  2. Junio C HamanoOct 20, 2009
  3. H. Peter AnvinOct 20, 2009
  4. Johan HerlandOct 20, 2009
  5. Nicolas PitreOct 20, 2009
  6. Junio C HamanoOct 20, 2009
  7. Nicolas PitreOct 20, 2009
  8. receive-pack: run "gc --auto" and optionally "update-server-info"Junio C Hamano, Oct 20, 2009
  9. Nicolas PitreOct 21, 2009
  10. Johannes SixtOct 21, 2009
  11. Junio C HamanoOct 21, 2009
  12. Junio C HamanoOct 21, 2009
  13. Johannes SixtOct 21, 2009
  14. Jan KrügerOct 21, 2009
  15. 1/2 gc --auto --quiet: make the notice a bit less verboaseJunio C Hamano, Oct 21, 2009
  16. 2/2 receive-pack: run "gc --auto --quiet " and optionally "update-server-info"Junio C Hamano, Oct 21, 2009
  17. Mikael MagnussonOct 20, 2009
  18. H. Peter AnvinOct 21, 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.