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

Re: [PATCH 1/2] run-command: introduce function to prepare auto-maintenance process

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 17, 2024, 15:53 UTC
Message-ID
<xmqq8r1c9ea2.fsf@gitster.g>
In-Reply-To
<929b6bfa08132523ee97f5adc376c3600f779a99.1713334241.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 7 quoted lines
> The `run_auto_maintenance()` function is responsible for spawning a new
> `git maintenance run --auto` process. To do so, it sets up the `sturct
> child_process` and then runs it by executing `run_command()` directly.
> This is rather inflexible in case callers want to modify the child
> process somewhat, e.g. to redirect stderr or stdout.
>
> Introduce a new `prepare_auto_maintenance()` function to plug this gap.

I guess the mention of "inflexible" and "redirection" above refers to some incompatibile behaviour we would introduce if we just replaced the manual spawning of "gc --auto" with a call to run_auto_maintenance(), but I would have expected that will be solved by making the interface to run_auto_maintenance() richer, not forcing the callers that would want to deviate from the norm to write the second half of the run_auto_maintenance() themselves.

Show 7 quoted lines
> +int run_auto_maintenance(int quiet)
> +{
> +	struct child_process maint = CHILD_PROCESS_INIT;
> +	if (!prepare_auto_maintenance(quiet, &maint))
> +		return 0;
>  	return run_command(&maint);
>  }

But given that the "second half" is to just call run_command() on the prepared child control structure, it is probably not a huge deal. It just felt somewhat an uneven API surface that 'quiet' can be controlled with just a single bit and doing anything more than that would require the caller to go into the structure to tweak.

Will queue.  Thanks.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 3 of 9 in “builtin/receive-pack: convert to use git-maintenance(1)”
  1. 0/2 builtin/receive-pack: convert to use git-maintenance(1)Patrick Steinhardt, Apr 17, 2024
  2. 1/2 run-command: introduce function to prepare auto-maintenance processPatrick Steinhardt, Apr 17, 2024
  3. Junio C HamanoApr 17, 2024
  4. Patrick SteinhardtApr 18, 2024
  5. 2/2 builtin/receive-pack: convert to use git-maintenance(1)Patrick Steinhardt, Apr 17, 2024
  6. Karthik NayakApr 17, 2024
  7. Karthik NayakApr 17, 2024
  8. Junio C HamanoApr 17, 2024
  9. Patrick SteinhardtApr 18, 2024

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.