git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Paul Smith <paul@mad-scientist.net>
To: "Stas Bekman" <stas@stason.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: "Martin Ågren" <martin.agren@gmail.com>,
	"Git Mailing List" <git@vger.kernel.org>,
	"Jeff King" <peff@peff.net>
Subject: Re: git silently ignores include directive with single quotes
Date: Sat, 08 Sep 2018 22:51:08 -0400	[thread overview]
Message-ID: <d9330ba54fbda54a92a9f4d9320836d88ce9a6e6.camel@mad-scientist.net> (raw)
In-Reply-To: <acf93aef-f1f8-1aab-a16d-9655402d445f@stason.org>

On Sat, 2018-09-08 at 13:13 -0700, Stas Bekman wrote:
> I remind that the original problem came from a simple command:
> 
>  git config --local include.path '../.gitconfig'
> 
> Which on linux removed the quotes and all was fine, and on windows
> the same command kept the quotes and the user was tearing his hair
> out trying to understand why the custom config was ignored.

I'm quite sure that the user was not using the Git Bash shell when they
entered this command, but instead using command.com or powershell or
some variant of that.

If you use Git Bash as your shell then quotes will be handled like any
POSIX shell and the above will do what (we all) expect.

If you use command.com and powershell and use single quotes, then the
single quotes will be put into the config file as you observed, because
those shells don't deal with single quotes.

You could use double-quotes, which ARE handled by command.com and
powershell; in that case they would be stripped out and would not
appear in the config.


If we were designing from scratch maybe using something like GNU make's
"include" vs "sinclude" (silent include--this is another name for the
already mentioned "-include") would work; maybe "path" and "spath" or
something.  But to make it work right you really want the default
behavior to be "warn if the file is not found" and have the special
behavior be "quiet if the file is not found" otherwise it doesn't
really help beginners to avoid errors.  And that's a backward-
compatibility problem.  To my mind, adding extra "check this" options
isn't very useful either: these kinds of warnings need to be on by
default to be effective.  The beginners, who need them, aren't going to
remember to add extra options to enable more checking.

What I personally think would be more useful would be some sort of
"verbose parsing" option to git config, that would parse the
configuration just as a normal Git command would and show diagnostic
output as the entire config is parsed: for each action line the config
file name and line number, and the operation performed (and any message
about it) would be printed.  This could be useful in a variety of
situations, for instance to discover conflicts between local, global,
and system configuration, easily see where settings are coming from,
etc.

And as part of this output, when an include file was not present or we
didn't have permissions or whatever, an appropriate error message would
be generated.

  parent reply	other threads:[~2018-09-09  3:52 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 [this message]
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
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=d9330ba54fbda54a92a9f4d9320836d88ce9a6e6.camel@mad-scientist.net \
    --to=paul@mad-scientist.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.com \
    --cc=peff@peff.net \
    --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).