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

Re: [PATCH v3 2/2] reflog: implement subcommand to drop reflogs

From
Christian Couder <christian.couder@gmail.com>
Date
Mar 18, 2025, 14:01 UTC
Message-ID
<CAP8UFD2+xQQbUevHTQangg__dq2M615pHLhYYUf7b9shpShD9Q@mail.gmail.com>
In-Reply-To
<20250314-493-add-command-to-purge-reflog-entries-v3-2-c24e23a6146d@gmail.com>
On Fri, Mar 14, 2025 at 9:41 AM Karthik Nayak <karthik.188@gmail.com> wrote:
Show 10 quoted lines
> +Options for `drop`
> +~~~~~~~~~~~~~~~~~~~~
> +
> +--all::
> +       Drop the reflogs of all references from all worktrees.
> +
> +--single-worktree::
> +       By default when `--all` is specified, reflogs from all working
> +       trees are dropped. This option limits the processing to reflogs
> +       from the current working tree only.

It seems to me that "--current-worktree" would have been clearer than "--single-worktree", but I understand that it would have been confusing to have a different name for basically the same option in `git reflog expire` and `git reflog drop`.

Show 15 quoted lines
> +       argc = parse_options(argc, argv, prefix, options, reflog_drop_usage, 0);
> +
> +       if (argc && do_all)
> +               usage(_("references specified along with --all"));
> +
> +       if (do_all) {
> +               struct worktree_reflogs collected = {
> +                       .reflogs = STRING_LIST_INIT_DUP,
> +               };
> +               struct string_list_item *item;
> +               struct worktree **worktrees, **p;
> +
> +               worktrees = get_worktrees();
> +               for (p = worktrees; *p; p++) {
> +                       if (single_worktree && !(*p)->is_current)

It looks like 'single_worktree' is only used here. This means that if a user forgets to add --all and only uses --single-worktree, nothing will happen and it seems to me that the command will exit with code 0. Even if `git reflog expire` already works like that, I think this is a bit unfortunate.

Otherwise this patch series looks very well done to me.
Thanks!
Previous: Karthik NayakNext: Junio C Hamano
Message 25 of 30 in “EDITME: cover title for 493-add-command-to-purge-reflog-entries”
  1. 0/2 EDITME: cover title for 493-add-command-to-purge-reflog-entriesKarthik Nayak, Mar 7, 2025
  2. 1/2 reflog: drop usage of global variablesKarthik Nayak, Mar 7, 2025
  3. Junio C HamanoMar 7, 2025
  4. Karthik NayakMar 10, 2025
  5. Junio C HamanoMar 10, 2025
  6. Karthik NayakMar 13, 2025
  7. 2/2 reflog: implement subcommand to drop reflogsKarthik Nayak, Mar 7, 2025
  8. Patrick SteinhardtMar 7, 2025
  9. Karthik NayakMar 7, 2025
  10. Patrick SteinhardtMar 7, 2025
  11. Karthik NayakMar 7, 2025
  12. Karthik NayakMar 7, 2025
  13. Junio C HamanoMar 7, 2025
  14. Karthik NayakMar 10, 2025
  15. Kristoffer HaugsbakkMar 10, 2025
  16. Karthik NayakMar 10, 2025
  17. Junio C HamanoMar 10, 2025
  18. reflog: implement subcommand to drop reflogsKarthik Nayak, Mar 10, 2025
  19. Patrick SteinhardtMar 12, 2025
  20. Karthik NayakMar 13, 2025
  21. Patrick SteinhardtMar 13, 2025
  22. 0/2 reflog: implement subcommand to drop reflogsKarthik Nayak, Mar 14, 2025
  23. 1/2 reflog: improve error for when reflog is not foundKarthik Nayak, Mar 14, 2025
  24. 2/2 reflog: implement subcommand to drop reflogsKarthik Nayak, Mar 14, 2025
  25. Christian CouderMar 18, 2025
  26. Junio C HamanoMar 18, 2025
  27. Christian CouderMar 19, 2025
  28. Karthik NayakMar 19, 2025
  29. Toon ClaesMar 18, 2025
  30. Karthik NayakMar 19, 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.