git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Philip Oakley <philipoakley@iee.org>
Cc: "Git Mailing List" <git@vger.kernel.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Martin Ågren" <martin.agren@gmail.com>,
	stas@stason.org
Subject: Re: [PATCH 1/1] config doc: highlight the name=value syntax
Date: Tue, 25 Sep 2018 15:03:05 -0700	[thread overview]
Message-ID: <xmqqlg7pnskm.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180924222416.5240-2-philipoakley@iee.org> (Philip Oakley's message of "Mon, 24 Sep 2018 23:24:16 +0100")

Philip Oakley <philipoakley@iee.org> writes:

> +Variable name/value syntax
> +^^^^^^^^^^^^^^^^^^^^^^^^^^
> +
>  All the other lines (and the remainder of the line after the section
>  header) are recognized as setting variables, in the form
>  'name = value' (or just 'name', which is a short-hand to say that
> @@ -69,7 +72,8 @@ 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.
> +verbatim. Single quotes are not special and form part of the
> +variable's value.
>  
>  Inside double quotes, double quote `"` and backslash `\` characters
>  must be escaped: use `\"` for `"` and `\\` for `\`.

Hmph.  This feels a bit backwards.  

The original paragraph is horrible in that there is no clear mention
that a pair of dq can be used to quote (which primarily is useful if
your value have leading or trailing whitespaces); the closest hint
is "enclosed in double quotes" we see in the pre-context.  The added
sentence singles out sq but it is unclear why it is necessary to
call out that it is not special---the readers can legitimately
wonder if backquotes are special or not and why.

I wonder if this is easier to understand:

    diff --git a/Documentation/config.txt b/Documentation/config.txt
    index ad0f4510c3..5eebd539df 100644
    --- a/Documentation/config.txt
    +++ b/Documentation/config.txt
    @@ -61,12 +61,16 @@ the variable is the boolean "true").
     The variable names are case-insensitive, allow only alphanumeric characters
     and `-`, and must start with an alphabetic character.

    +The value part can have segments that are enclosed in a pair of
    +double quotes (note: other kinds of quoting character pairs are not
    +special)--the double quotes are stripped from the value.
    +
     A line that defines a value can be continued to the next line by
     ending it with a `\`; the backquote 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
    +whitespaces of the line are discarded.
    +Internal whitespaces within the value are retained
     verbatim.

     Inside double quotes, double quote `"` and backslash `\` characters

> @@ -89,10 +93,14 @@ each other with the exception that `includeIf` sections may be ignored
>  if their condition does not evaluate to true; see "Conditional includes"
>  below.
>  
> +Both the `include` and `includeIf` sections implicitly apply an 'if found'
> +condition to the given path names.
> +

Mentioning that missing target file is not an error is definitely an
improvement.  I've never viewed it as applying "if found" condition
myself, but it is not wrong per-se to do so, I would think.

>  You can include a config file from another by setting the special
>  `include.path` (or `includeIf.*.path`) variable to the name of the file
>  to be included. The variable takes a pathname as its value, and is
> -subject to tilde expansion. These variables can be given multiple times.
> +subject to tilde expansion and the value syntax detailed above.
> +These variables can be given multiple times.

I have a mild suspicion that this adds negative value.  Singling out
that "[include] path = ..."  follows the usual value syntax makes
the readers wonder if there are some "[section] variable = ..." that
does not follow the value syntax that they have to be aware of and
careful about.

  reply	other threads:[~2018-09-25 22:03 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-08 18:58 git silently ignores include directive with single quotes Stas Bekman
2018-09-08 19:30 ` Martin Ågren
2018-09-08 19:44   ` Stas Bekman
2018-09-08 19:53   ` Stas Bekman
2018-09-08 20:02     ` Ævar Arnfjörð Bjarmason
2018-09-08 20:13       ` Stas Bekman
2018-09-08 20:28         ` Ævar Arnfjörð Bjarmason
2018-09-08 20:58           ` Stas Bekman
2018-09-09  2:51         ` Paul Smith
2018-09-09  2:57           ` Stas Bekman
2018-09-08 19:54   ` Ævar Arnfjörð Bjarmason
2018-09-08 20:04     ` Stas Bekman
2018-09-08 20:16       ` Ævar Arnfjörð Bjarmason
2018-09-08 21:14     ` Jeff King
2018-09-08 22:10       ` Ramsay Jones
2018-09-09  2:33         ` Jeff King
2018-09-11 20:36           ` Junio C Hamano
2018-09-11 20:57             ` Jeff King
2018-09-23 22:48               ` Stas Bekman
2018-09-24 21:08                 ` Ævar Arnfjörð Bjarmason
2018-09-24 23:20                   ` Stas Bekman
2018-09-24 22:24                 ` [PATCH 0/1] " Philip Oakley
2018-09-24 23:05                   ` Stas Bekman
2018-09-24 22:24                 ` [PATCH 1/1] config doc: highlight the name=value syntax Philip Oakley
2018-09-25 22:03                   ` Junio C Hamano [this message]
2018-09-08 22:32       ` git silently ignores include directive with single quotes Ævar Arnfjörð Bjarmason
2018-09-09  2:29         ` Jeff King
2018-09-08 21:22 ` Jeff King
2018-09-08 22:49   ` Stas Bekman
2018-09-09  2:30     ` Jeff King
2018-09-10 17:04   ` Junio C Hamano
2018-09-10 17:14     ` Jonathan Nieder
2018-09-10 18:30       ` Junio C Hamano
2018-09-10 18:35         ` Jonathan Nieder
2018-09-10 19:17           ` Junio C Hamano
2018-09-10 19:52             ` Stas Bekman
2018-09-10 20:10               ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqlg7pnskm.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.org \
    --cc=stas@stason.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).