From: Dragan Simic <dsimic@manjaro•org>
To: rsbecker@nexbridge•com
Cc: 'Junio C Hamano' <gitster@pobox•com>,
'Ralph Seichter via GitGitGadget' <gitgitgadget@gmail•com>,
git@vger•kernel.org, 'Ralph Seichter' <github@seichter•de>
Subject: Re: [PATCH v2] config: add --comment option to add a comment
Date: Mon, 11 Mar 2024 18:00:40 +0100 [thread overview]
Message-ID: <e7fe2e229f0b5c76fdec1d789bfecd6e@manjaro.org> (raw)
In-Reply-To: <0b8701da73d3$fa0f2080$ee2d6180$@nexbridge.com>
On 2024-03-11 17:48, rsbecker@nexbridge•com wrote:
> On Monday, March 11, 2024 12:17 PM, Dragan Simic wrote:
>> Subject: Re: [PATCH v2] config: add --comment option to add a comment
>>
>> On 2024-03-11 13:55, Junio C Hamano wrote:
>>> "Ralph Seichter via GitGitGadget" <gitgitgadget@gmail•com> writes:
>>>
>>>> From: Ralph Seichter <github@seichter•de>
>>>>
>>>> Introduce the ability to append comments to modifications made using
>>>> git-config. Example usage:
>>>>
>>>> git config --comment "changed via script" \
>>>> --add safe.directory /home/alice/repo.git
>>>>
>>>> based on the proposed patch, the output produced is:
>>>>
>>>> [safe]
>>>> directory = /home/alice/repo.git #changed via script
>>>
>>> For readability, you probably would want to have a SP before the
>>> given
>>> string, i.e.,
>>>
>>> variable = "value" # message comes here
>>
>> Let me interject... Perhaps also a tab character before the "#
>> comment",
> instead of a space character. That would result in even better
>> readability.
>
> Does adding a tab following data change the parse semantics of
> .gitconfig?
> My naïve understanding is that .gitconfig follows a basic rule of
> leading
> tab within a section, followed by text. Is there a formal syntax
> description
> of what valid input is? The value does not need to be quoted, so what
> does
> the following actually resolve to:
>
> (TAB)variable = value(TAB)# comment.
>
> Does variable mean value or value(TAB)? Obviously TABS should be
> correctly
> be interpreted as whitespace to be ignored. However, what about:
>
> (TAB)variable = value(TAB)s(TAB) # comment.
>
> Does that mean value(TAB)s, value(TAB)s(TAB), value s, value s(TAB),
> values?
It should mean "value(TAB)s", according to git-config(1).
> The definition according to git-config is
>
> "The syntax is fairly flexible and permissive; whitespaces are mostly
> ignored. The # and ; characters begin comments to the end of line,
> blank
> lines are ignored."
I believe these two quotations from git-config(1) should make it more
clear:
A line that defines a value can be continued to the next line by
ending
it with a \; the backslash and the end-of-line are stripped. Leading
whitespaces after name =, the remainder of the line after the first
comment character # or ;, and trailing whitespaces of the line are
discarded unless they are enclosed in double quotes. Internal
whitespaces within the value are retained verbatim.
The following escape sequences (beside \" and \\) are recognized: \n
for newline character (NL), \t for horizontal tabulation (HT, TAB)
and
\b for backspace (BS). Other char escape sequences (including octal
escape sequences) are invalid.
To me, all that indicates that trailing tab characters are stripped,
but...
> "Mostly" does not make me comfortable that this is formally allowed or
> disallowed or ignored. I would suggest that this change needs to
> formalize
> the grammar on that documentation page for clarity.
... I do agree that it should be clarified further in the man page.
next prev parent reply other threads:[~2024-03-11 17:00 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 6:00 [PATCH] Allow git-config to append a comment Ralph Seichter via GitGitGadget
2024-03-06 16:01 ` Junio C Hamano
2024-03-06 17:24 ` Ralph Seichter
2024-03-07 12:12 ` Junio C Hamano
2024-03-07 12:44 ` Ralph Seichter
2024-03-07 13:27 ` Junio C Hamano
2024-03-07 13:53 ` rsbecker
2024-03-07 15:26 ` Ralph Seichter
2024-03-07 15:40 ` rsbecker
2024-03-07 15:57 ` Ralph Seichter
2024-03-07 15:15 ` [PATCH v2] config: add --comment option to add " Ralph Seichter via GitGitGadget
2024-03-11 12:55 ` Junio C Hamano
2024-03-11 16:17 ` Dragan Simic
2024-03-11 16:48 ` rsbecker
2024-03-11 17:00 ` Dragan Simic [this message]
2024-03-11 17:52 ` Dragan Simic
2024-03-11 17:29 ` Junio C Hamano
2024-03-11 17:34 ` Dragan Simic
2024-03-11 19:54 ` Junio C Hamano
2024-03-12 2:25 ` Dragan Simic
2024-03-11 18:23 ` Ralph Seichter
2024-03-11 18:50 ` Dragan Simic
2024-03-11 18:57 ` Ralph Seichter
2024-03-11 19:04 ` Dragan Simic
2024-03-11 21:31 ` Junio C Hamano
2024-03-12 2:38 ` Dragan Simic
2024-03-11 19:17 ` rsbecker
2024-03-12 2:27 ` Dragan Simic
2024-03-11 18:16 ` Ralph Seichter
2024-03-11 18:55 ` Dragan Simic
2024-03-11 19:04 ` Ralph Seichter
2024-03-12 6:19 ` Ralph Seichter
2024-03-12 6:37 ` Chris Torek
2024-03-12 7:28 ` Ralph Seichter
2024-03-12 7:44 ` Junio C Hamano
2024-03-12 21:47 ` [PATCH v3] " Ralph Seichter via GitGitGadget
2024-03-15 22:15 ` Junio C Hamano
2024-03-15 22:26 ` [PATCH 3/1] config: allow tweaking whitespace between value and comment Junio C Hamano
2024-03-26 22:06 ` Junio C Hamano
2024-03-26 22:48 ` Ralph Seichter
2024-03-26 23:27 ` Junio C Hamano
2024-03-27 0:27 ` Ralph Seichter
2024-03-27 1:23 ` Dragan Simic
2024-03-27 17:27 ` Junio C Hamano
2024-03-15 23:10 ` [PATCH v3] config: add --comment option to add a comment Eric Sunshine
2024-03-15 23:41 ` Junio C Hamano
2024-03-15 23:44 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e7fe2e229f0b5c76fdec1d789bfecd6e@manjaro.org \
--to=dsimic@manjaro$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=gitgitgadget@gmail$(echo .)com \
--cc=github@seichter$(echo .)de \
--cc=gitster@pobox$(echo .)com \
--cc=rsbecker@nexbridge$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox