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

Re: [PATCH 08/11] builtin/maintenance: let tasks do maintenance before and after detach

From
Patrick Steinhardt <ps@pks.im>
Date
May 30, 2025, 14:05 UTC
Message-ID
<aDm7JeVg9vqsq-09@pks.im>
In-Reply-To
<6E33013D-8336-4BE1-9DBB-CAFF835A49C3@gmail.com>
On Fri, May 30, 2025 at 08:56:38AM -0400, Ben Knoble wrote:
Show 9 quoted lines
> > @@ -1599,20 +1600,25 @@ static const struct maintenance_task tasks[] = {
> > static int maybe_run_task(const struct maintenance_task *task,
> >             struct repository *repo,
> >             struct maintenance_run_opts *opts,
> > -              struct gc_config *cfg)
> > +              struct gc_config *cfg,
> > +              int before)
> 
> Perhaps we can use a small enum…
Show 22 quoted lines
> > @@ -1641,6 +1647,10 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
> >   }
> >   free(lock_path);
> > 
> > +    for (size_t i = 0; i < opts->tasks_nr; i++)
> > +        if (maybe_run_task(&tasks[opts->tasks[i]], r, opts, cfg, 1))
> 
> So that is clear what « 1 » (« BEFORE ») does here…
> 
> > +            result = 1;
> > +
> >   /* Failure to daemonize is ok, we'll continue in foreground. */
> >   if (opts->detach > 0) {
> >       trace2_region_enter("maintenance", "detach", the_repository);
> > @@ -1649,7 +1659,7 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
> >   }
> > 
> >   for (size_t i = 0; i < opts->tasks_nr; i++)
> > -        if (maybe_run_task(&tasks[opts->tasks[i]], r, opts, cfg))
> > +        if (maybe_run_task(&tasks[opts->tasks[i]], r, opts, cfg, 0))
> 
> And « 0 » (« AFTER ») does here?

Yeah, I was very close to adding one, but then decided against it to not produce additional churn. But agreed, it would be way easier to read this way, so let me add one.

Patrick
Previous: Ben Knoble
Message 2 of 2 in “Re: [PATCH 08/11] builtin/maintenance: let tasks do maintenance before and after detach”
  1. Ben KnobleMay 30, 2025
  2. Patrick SteinhardtMay 30, 2025

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.