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

Re: [PATCH v3] builtin/revert.c: refactor using an enum for cmd-action

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 11, 2024, 21:47 UTC
Message-ID
<xmqqzfxbee4b.fsf@gitster.g>
In-Reply-To
<20240111200627.64199-1-mi.al.lohmann@gmail.com>
Michael Lohmann <mi.al.lohmann@gmail.com> writes:
Show 27 quoted lines
> This is done to avoid having to keep the char values in sync in
> different places and also to get compiler warnings on non-exhaustive
> switches.
>
> In the rebase `action` enum there is the enumeration constant
> `ACTION_NONE` which is not particularly descriptive, since it seems to
> imply that no action should be taken. Instead it signals a start of a
> revert/cherry-pick process, so here `ACTION_START` was chosen.
>
> Co-authored-by: Wanja Henze <wanja.hentze@bevuta.com>
> Signed-off-by: Michael Lohmann <mi.al.lohmann@gmail.com>
> ---
>
> On 11. Jan 2024, at 20:37, Junio C Hamano <gitster@pobox.com> wrote:
>> Phillip Wood <phillip.wood123@gmail.com> writes:
>> > I think ACTION_NONE was intended to covey that the user did not pass
>> > one of the OPT_CMDMODE() options like "--continue" as there isn't a
>> > "--start" option. I don't have a strong opinion between "_NONE" and
>> > "_START".
>>
>> I agree with you why NONE is called as such.  If "revert" does not
>> take "--start" (I do not remember offhand), I would think it would
>> be better to follow suit.
> My point was that yes, it might be in sync with what the user passes in
> as arguments, but when I followed the code and saw lots of references to
> ACTION_NONE I was puzzled, since my intuition of that name was that
> _no action_ should be taken (which did not make sense to me).

I know you wrote that ;-). But _NONE is "no action was specified", and has been so for a long time in the context of "rebase". I do not see any confusion expressed there. I do not expect to see any confusion here, either, if we were to introduce these new enum.

Previous: Michael LohmannNext: Junio C Hamano
Message 6 of 11 in “builtin/revert.c: refactor using an enum for cmd-action”
  1. builtin/revert.c: refactor using an enum for cmd-actionMichael Lohmann, Jan 11, 2024
  2. Phillip WoodJan 11, 2024
  3. builtin/revert.c: refactor using an enum for cmd-actionMichael Lohmann, Jan 11, 2024
  4. Junio C HamanoJan 11, 2024
  5. builtin/revert.c: refactor using an enum for cmd-actionMichael Lohmann, Jan 11, 2024
  6. Junio C HamanoJan 11, 2024
  7. Junio C HamanoJan 12, 2024
  8. Jeff KingJan 12, 2024
  9. Junio C HamanoJan 12, 2024
  10. Michael LohmannJan 12, 2024
  11. Junio C HamanoJan 11, 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.