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

Re: [GSoC] [PATCH] builtin/gc: Replace run_command with C function refs_pack_refs

From
Vvk <g@vkabc.me>
Date
Mar 28, 2024, 04:12 UTC
Message-ID
<0a149be978e68271c251e80f8eb571f4@vkabc.me>
In-Reply-To
<20240328040010.40230-1-g@vkabc.me>
On 2024-03-28 12:00, vk wrote:
Show 31 quoted lines
> Replace "git pack-refs" with C function refs_pack_refs
> for maintenance_task_pack_refs(). C function refs_pack_refs
> can be called directly, hence saving an external process.
> ---
>  builtin/gc.c | 29 +++++++++++++++++++++++------
>  1 file changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/builtin/gc.c b/builtin/gc.c
> index 3c874b248b..b55c5f5225 100644
> --- a/builtin/gc.c
> +++ b/builtin/gc.c
> @@ -42,6 +42,8 @@
>  #include "setup.h"
>  #include "trace2.h"
> 
> +#include <revision.h>
> +
>  #define FAILED_RUN "failed to run %s"
> 
>  static const char * const builtin_gc_usage[] = {
> @@ -218,14 +220,29 @@ static int pack_refs_condition(void)
> 
>  static int maintenance_task_pack_refs(MAYBE_UNUSED struct 
> maintenance_run_opts *opts)
>  {
> -	struct child_process cmd = CHILD_PROCESS_INIT;
> 
> -	cmd.git_cmd = 1;
> -	strvec_pushl(&cmd.args, "pack-refs", "--all", "--prune", NULL);
> -	if (opts->auto_flag)
> -		strvec_push(&cmd.args, "--auto");

I forgot to add this --auto optional logic. Will add it in the following patch.

Thanks
Previous: vkNext: Junio C Hamano
Message 2 of 3 in “builtin/gc: Replace run_command with C function refs_pack_refs”
  1. vkMar 28, 2024
  2. vkMar 28, 2024
  3. Junio C HamanoMar 28, 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.