git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Arjun Sreedharan <arjun024@gmail.com>,
	Philip Oakley <philipoakley@iee.org>, Git <git@vger.kernel.org>
Subject: Re: [PATCH] introduce git root
Date: Fri, 5 Dec 2014 03:27:17 +0100	[thread overview]
Message-ID: <CAP8UFD2P9P9zL=irZ-7uPD6+bEhxaiABowh0O3RT01Ov3VqT6w@mail.gmail.com> (raw)
In-Reply-To: <20141204211232.GC19953@peff.net>

Jeff King <peff@peff.net> wrote:

> Some of the discussion has involved mixing config options into this
> kitchen sink, but that does not make any sense to me (and is why I
> find "git var -l" so odd). Config options are fundamentally different, in
> that they are set and retrieved, not computed (from other config
> variables, or from hard-coded values). And we already have a nice
> tool for working with them (well...nice-ish, let's say).

Yeah, but "git config" cannot say which config option applies in some
context and why.
For example, to chose the editor all the following could apply:

GIT_SEQUENCE_EDITOR env variable
sequence.editor config variable
GIT_EDITOR env variable
core.editor config variable
VISUAL env variable
EDITOR env variable
editor configured at compile time

and the user or our own scripts right now cannot easily know which
editor should be used when editing the sequence list.

The best they can do is:

- first check if GIT_SEQUENCE_EDITOR is set, and if yes, use it
- then check if sequence.editor config variable is set, and if yes, use it
- then use "git var GIT_EDITOR" that will check the other options

I don't think it is very nice.

Jeff King <peff@peff.net> also wrote:

> My issue is only that "git --foo" has other options besides computables.
> So you need to name each option in a way that makes it clear it is
> reporting a computable and not doing something else.
>
> Take "git --pager" for instance. That would be a natural choice to
> replace "git var GIT_PAGER". But shouldn't "--pager" be the opposite of
> the existing "--no-pager"?
>
> So instead we probably need some namespace to indicate that it is a
> "showing" option. Like "--show-pager". And then for consistency, we
> would probably want to move "--exec-path" to "--show-exec-path",
> creating a new "--show-" namespace. Or we could call that namespace
> "git var". :)

I agree with that, but I think it could be better if there was also a
notion of context,

> I do not think "git var --exec-path" is a good idea, nor GIT_EXEC_PATH
> for the environment-variable confusion you mentioned. I was thinking of
> just creating a new namespace, like:
>
>   git var exec-path
>   git var author-ident

I agree that this is nice, but I wonder what we would do for the
sequence editor and the default editor.
Maybe:

git var sequence-editor
git var editor

That would already be nicer than what we have now, but maybe we should
consider the following instead:

git var sequence.editor
git var core.editor

(and maybe also some aliases to core.editor, like:

git var default.editor
git var editor)

I think "sequence.editor" and "core.editor" are better because:

- they use the same syntax as the config variables, so they are easier
to remember and to discover, and
- they provide a notion of context.

The notion of context is interesting because suppose that we later
introduce the "commit.editor" config variable. If we decide now that
"foo.editor" means just "core.editor" if we don't know about any
"editor" variable related to the "foo" context, then the scripts that
might later be written using "git var commit.editor" will not have to
worry about the fact that previous versions of Git didn't know about
"commit.editor".

People could even start using "git var commit.editor" now, because it
would work even if "commit.editor" is unused by git commit.

Of course when the user asks for "git var foo.editor" and we don't
know about any "editor" variable related to the "foo" context, we
first should check if "foo.editor" exists in the config file and we
should use that if it exists, before we default to "git var
core.editor".

Best,
Christian.

  parent reply	other threads:[~2014-12-05  2:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 20:00 [PATCH] introduce git root Arjun Sreedharan
2014-11-29 23:08 ` Philip Oakley
2014-11-30  4:35   ` Arjun Sreedharan
2014-11-30 11:58     ` Matthieu Moy
2014-12-01  3:04       ` Junio C Hamano
2014-12-01  4:17         ` Christian Couder
2014-12-01  4:53           ` Junio C Hamano
2014-12-02  7:04           ` Jeff King
2014-12-02 10:05             ` Christian Couder
2014-12-02 17:26             ` Junio C Hamano
2014-12-04  9:22               ` Jeff King
2014-12-04 19:02                 ` Junio C Hamano
2014-12-04 20:00                   ` Matthieu Moy
2014-12-04 20:19                     ` Junio C Hamano
2014-12-04 21:12                   ` Jeff King
2014-12-04 21:30                     ` Junio C Hamano
2014-12-05  2:27                     ` Christian Couder [this message]
2014-12-05  9:27                       ` Jeff King
2014-12-07  5:23                         ` Christian Couder
2014-12-09 18:17                         ` Junio C Hamano
2014-12-10  9:16                           ` Christian Couder
2014-12-10 20:10                           ` Jeff King
2014-12-10 21:08                             ` 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='CAP8UFD2P9P9zL=irZ-7uPD6+bEhxaiABowh0O3RT01Ov3VqT6w@mail.gmail.com' \
    --to=christian.couder@gmail.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=arjun024@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.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.
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 NNTP newsgroup(s).