Re: [PATCH v2 01/35] CodingGuidelines: update and clarify command-line conventions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 30 2022, Junio C Hamano wrote:

> Junio C Hamano <gitster@xxxxxxxxx> writes:
>
>> Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:
>>
>>>   Optional parts are enclosed in square brackets:
>>> -   [<extra>]
>>> -   (Zero or one <extra>.)
>>> +   [<file>...]
>>> +   (Zero or more of <file>.)
>>
>> OK.
>>
>>> + Use spacing around "|" token(s), but not immediately after opening or
>>> + before closing a [] or () pair:
>>> +   Do: [-q | --quiet]
>>> +   Don't: [-q|--quiet]
>>> +
>>> + Don't use spacing around "|" tokens when they're used to seperate the
>>> + alternate arguments of an option:
>>> +    Do: --track[=(direct|inherit)]
>>> +    Don't: --track[=(direct | inherit)]
>>> +
>>
>> Hmph, that sounds inconsistent; I would have expected the same use
>> (or omission) of space around the vertical bar.  But if that is the
>> prevailing style, I won't complain about writing it down.
>
> Perhaps in order to avoid "Huh? isn't that inconsistent?" knee-jerk
> reaction, it may be a good idea to explain the reason why?

I have a prepared v3 I was about to submit soon which points to existing
examples in the commit message, namely:

	git grep -E -o '=\([^)]+\|[^)]+\)' -- builtin Documentation/

> I am guessing that the difference between the two has something to
> do with the desire to make it compact when it appears as a "value"
> for something (signalled after a "=" sign), but (1) I am not sure if
> you share the reasoning, and more importantly (2) I am failing to
> come up with a concise way to phrase it.

I'm afraid mind reading is not one of my many talents :)

I wasn't seeking to come up with some post-hoc rationalization for
these, but just to fill in the gaps in the CodingGuidelines.

Any such guidelines are ultimately rather arbitrary, but I think most
would agree that whatever arbitrary thing we use we should probably pick
one if we can help it.

Which is what this series is aiming to do, i.e. to make these consistent
with the prevailing style, and homogenize the style of the *.txt and -h
version.

I think that's reason enough, i.e. to just decree "this is how it is".

Looking back at history you seem to have had the first commit with this
syntax, with many other people following shortly thereafter:

	git log --reverse -p -G'--.*=\([^)]+\|[^)]+\)' --

So if you want a rationale there your guess is probably better than
mine...




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux