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

Re: [PATCH v3 5/7] builtin/maintenance: introduce "worktree-prune" task

From
Patrick Steinhardt <ps@pks.im>
Date
May 7, 2025, 07:06 UTC
Message-ID
<aBsGg7w_4uKyQSaQ@pks.im>
In-Reply-To
<CAPig+cScor=E2i4w99NCrsaUd-Po=FqhkrLSyT69PSo1+h2dRw@mail.gmail.com>
On Mon, May 05, 2025 at 04:59:14AM -0400, Eric Sunshine wrote:
Show 11 quoted lines
> On Fri, May 2, 2025 at 4:44 AM Patrick Steinhardt <ps@pks.im> wrote:
> > +                       limit--;
> > +
> > +                       if (!limit) {
> > +                               should_prune = 1;
> > +                               goto out;
> > +                       }
> > +               }
> > +               free(wtpath);
> 
> This leaks `wtpath` when it takes the `goto out` arm.
Good catch, fixed now.
Show 23 quoted lines
> > +       }
> > +
> > +out:
> > +       strvec_clear(&worktrees);
> > +       strbuf_release(&reason);
> > +       return should_prune;
> > +}
> > diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
> > @@ -493,6 +493,77 @@ test_expect_success 'reflog-expire task --auto only packs when exceeding limits'
> > +test_expect_success 'worktree-prune task with --auto honors maintenance.worktree-prune.auto' '
> > +       # A negative value should always prune.
> > +       test_expect_worktree_prune git -c maintenance.worktree-prune.auto=-1 maintenance run --auto --task=worktree-prune &&
> > +
> > +       mkdir .git/worktrees &&
> > +       : >.git/worktrees/first &&
> > +       : >.git/worktrees/second &&
> > +       : >.git/worktrees/third &&
> > +
> > +       # Zero should never prune.
> > +       test_expect_worktree_prune ! git -c maintenance.worktree-prune.auto=0 maintenance run --auto --task=worktree-prune &&
> > +       # A positive value should require at least this man prunable worktrees.
> 
> s/man/many/
Fixed, as well.
Patrick
Previous: Eric SunshineNext: Patrick Steinhardt
Message 10 of 15 in “builtin/maintenance: implement missing tasks compared to git-gc(1)”
  1. 0/7 builtin/maintenance: implement missing tasks compared to git-gc(1)Patrick Steinhardt, May 2, 2025
  2. 1/7 builtin/gc: fix indentation of `cmd_gc()` parametersPatrick Steinhardt, May 2, 2025
  3. 2/7 builtin/gc: remove global variables where it trivial to doPatrick Steinhardt, May 2, 2025
  4. 3/7 builtin/gc: move pruning of worktrees into a separate functionPatrick Steinhardt, May 2, 2025
  5. 4/7 worktree: expose function to retrieve worktree namesPatrick Steinhardt, May 2, 2025
  6. Eric SunshineMay 5, 2025
  7. Patrick SteinhardtMay 7, 2025
  8. 5/7 builtin/maintenance: introduce "worktree-prune" taskPatrick Steinhardt, May 2, 2025
  9. Eric SunshineMay 5, 2025
  10. Patrick SteinhardtMay 7, 2025
  11. 6/7 builtin/gc: move rerere garbage collection into separate functionPatrick Steinhardt, May 2, 2025
  12. 7/7 builtin/maintenance: introduce "rerere-gc" taskPatrick Steinhardt, May 2, 2025
  13. Derrick StoleeMay 2, 2025
  14. Junio C HamanoMay 2, 2025
  15. Patrick SteinhardtMay 5, 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.