git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Paul Tan <pyokagan@gmail.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Luis Ressel <aranea@aixah.de>,
	git@vger.kernel.org,
	Christian Couder <christian.couder@gmail.com>
Subject: Re: [GSoC microproject] Add XDG support to the credential-store helper
Date: Sat, 7 Mar 2015 03:21:02 +0800	[thread overview]
Message-ID: <CACRoPnQe67OFta276aQRiAoMcWdWO-3njHpnx8MHnkm5kieW=Q@mail.gmail.com> (raw)
In-Reply-To: <vpqa8zq9grq.fsf@anie.imag.fr>

Hi,

Reading my previous message again, I apologize if it sounded
conflicting. Truth to be told, I see merits in both proposed
behaviors, but it all depends on whether we want git-credentials-store
to support an arbitrary number of config files (now or in the future)
or just two. I'm not sitting on the fence though, personally I think
that we should go with supporting an arbitrary number of config files
(and the behavior it entails for xdg file vs home file), because it
will open up more possibilities in the future with regards to
supporting multiple config sources.

On Sat, Mar 7, 2015 at 1:28 AM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> The fact that I suggested doing it this way does not mean it _has_ to be
> done this way. Decisions are taken by trying to reach a consensus with
> discussion, so everyone is welcome to argue.

Well, I think we need to decide if git is going to implement support
for XDG_CONFIG_DIRS as well, as support for reading/writing an
arbitrary number of config files will affect my views on the behavior.
Personally, I think git-credentials-store should implement support for
XDG_CONFIG_DIRS because, as I mentioned in the previous message,
administrators may wish to provide users with default saved
credentials.

If machinery is being added to support reading/writing to an arbitrary
number of config files, it would lead to simpler behavior (and simpler
code) if the old ~/.git-credentials is just treated as just another
config file to load from. (So yes, I agree with implementing your
proposed behavior)

However, if we are just going to support 2 configuration files (the
xdg file and the home file), then I think Luis' proposed behavior has
some merit. See below.

(Just mentioning for completeness) The third option would be to
implement a hybrid of the above two approaches (support arbitrary
number of config files, but only choose 1 between the xdg file and
home file), but this behavior is unnecessarily complex.

> I don't remember all the discussions we had about the ~/.gitconfig, but
> one issue with considering only one file is if you create
> ~/.git/config/foo and initially make sure you don't have ~/.gitfoo, and
> then one tool creates ~/.gitfoo (either an old Git, or another tool
> trying to edit the config file), then you totally break your
> configuration.
> I argued for not taking backward compatibility too much into account in
> another thread, but that was about precedence of one file over the other
> which is far less important. Here, any tool creating even an empty home
> file would break your configuration.

Luis mentioned that if the user expects to use an old version of git,
the user would (or should) not create the xdg file in the first place.
I think that automated tools (and users) should call git-config to
edit the config files anyway and not roll their own. In fact, I think
that this issue will not occur at all if git prioritized
~/.config/git/foo over ~/.gitfoo instead of the other way around. When
the user creates the xdg file, the user is signaling that old versions
of git will not be used. Thus, if a tool creates/updates the old home
file (and it should not if it calls git-config), then configuration
changes won't take effect at all, and it _shouldn't_ because the tool
is _broken_.

But yes, the above strategy does not scale at all for multiple
configuration sources, which there will be if support for
XDG_CONFIG_DIRS is implemented.

(As an aside, I find it weird that git-config allows values in
~/.gitconfig to override ~/.config/git/config, given that the xdg file
is opt-in and introduced after ~/.gitconfig. Furthermore, it conflicts
with its writing behavior -- it writes to ~/.config/git/config and not
~/.gitconfig if it exists.)

> That also breaks the least surprise principle if you have a ~/.gitfoo
> file that you forgot about: edit ~/.config/git/foo, nothing is taken
> into account, at all (or the other way around, depending on the
> precedence you choose). I remember loosing some time with two vlc
> configuration files like this.

Hmm, I don't know the exact specifics of what happened with VLC, so I
can't judge. As mentioned above, if the user wants compatibility with
old tools, the user will not create the xdg file. If the user has an
updated toolset, the user will create the xdg file and delete the old
home file. The old home file will not be created at all because all
tools would have been updated to support the xdg file, and hence the
user will not be confused.

Of course, in the context of git-config, it has to read the files in
/etc/gitconfig, $GIT_DIR/config etc, and thus as mentioned above,
reading from the home file as well would lead to simpler behavior and
code.

Regards,
Paul

      reply	other threads:[~2015-03-06 19:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 20:51 [GSoC microproject] Add XDG support to the credential-store helper Luis Ressel
2015-03-05 20:53 ` [PATCH] " Luis Ressel
2015-03-05 22:10 ` [GSoC microproject] " Junio C Hamano
2015-03-05 22:38 ` Christian Couder
2015-03-05 23:15   ` Luis Ressel
2015-03-05 23:41     ` Luis Ressel
2015-03-06  8:04       ` Paul Tan
2015-03-06 17:28         ` Matthieu Moy
2015-03-06 19:21           ` Paul Tan [this message]

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='CACRoPnQe67OFta276aQRiAoMcWdWO-3njHpnx8MHnkm5kieW=Q@mail.gmail.com' \
    --to=pyokagan@gmail.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=aranea@aixah.de \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.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).