Skip to contentSkip to conversation

Unbalanced closing paren in help of git commit

Tomas Nordin Tomas Nordin 1 participant 1 message Jul 9, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

[Sorry, I think I forgot to CC the list when I sent the below message]

-------------------- Start of forwarded message --------------------
From: Tomas Nordin <[email protected]>
To: Junio C Hamano <[email protected]>
Subject: Re: Unbalanced closing paren in help of git commit
Date: Mon, 08 Jul 2024 23:11:16 +0200

Quoted 21 lines · Junio C Hamano
Quoted 3 lines · Tomas Nordin

Hello List

The second line of the help message for git commit looks like this:

This seems to have come from 00ea64ed (doc/git-commit: add documentation for fixup=[amend|reword] options, 2021-03-15), if "git blame" is to be trusted.

Quoted 1 line
    [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>)]

We can have --dry-run but we do not have to, we can have only one of

    "-c <commit>"
    "-C <commit>",
    "--squash <commit>",
    "--fixup amend:<commit>"
    "--fixup reword:<commit>", or
    "--fixup <commit>"
Quoted 5 lines

as they are mutually exclusive, but it is OK if we have none of them.

The last closing parenthesis after <commit> but before the closing square bracket is unwanted, I think, as you pointed out.

Maybe explicit grouping of the mutually exclusive option-argument pairs is better? Like this:

[--dry-run] [((-c | -C | --squash) <commit>) | (--fixup [(amend|reword):]<commit>)]

The closing paren would then make sense. I /think/ this is the way I would have written it.
-------------------- End of forwarded message --------------------