From: Junio C Hamano <gitster@pobox•com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
Cc: Paul Tan <pyokagan@gmail•com>, Jeff King <peff@peff•net>,
Git List <git@vger•kernel.org>
Subject: Re: [PATCH v3 1/4] git-credential-store: support multiple credential files
Date: Sun, 15 Mar 2015 13:03:26 -0700 [thread overview]
Message-ID: <xmqqy4myt4dt.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <vpqbnju7aex.fsf@anie.imag.fr> (Matthieu Moy's message of "Sun, 15 Mar 2015 12:44:06 +0100")
Matthieu Moy <Matthieu.Moy@grenoble-inp•fr> writes:
> Junio C Hamano <gitster@pobox•com> writes:
>
>> Paul Tan <pyokagan@gmail•com> writes:
>>
>>>> I think you could even get away without passing default_fn here, and
>>>> just use the rule "the first file in the list is the default". Unless
>>>> you are anticipating ever passing something else, but I couldn't think
>>>> of a case where that would be useful.
>>>
>>> Even though in this case the store_credential() function is not used
>>> anywhere else, from my personal API design experience I think that
>>> cementing the rule of "the first file in the list is the default" in
>>> the behavior of the function is not a good thing. For example, in the
>>> future, we may wish to keep the precedence ordering the same, but if
>>> none of the credential files exist, we create the XDG file by default
>>> instead.
>>
>> I am not sure if this is not a premature over-engineering
>
> I would say so if having this default_fn made the code more complex,
True, or if it made caller(s) be redundant or repeat themselves
without a good reason. Otherwise we would end up having to drop the
redundant and/or unnecessary arguments in future clean-up patches; I
had to de-conflict a series with 7ce7c760 (convert: drop arguments
other than 'path' from would_convert_to_git(), 2014-08-21) recently,
which reminded me of this point ;-).
> but
> here the code is basically
>
> + if (default_fn)
> + store_credential_file(default_fn, c);
>
> and
>
> - store_credential(file, &c);
> + store_credential(&fns, &c, fns.items[0].string);
>
> Taking the first element in the list wouldn't change much.
>
> I'm personally fine with both versions.
Turning the current code to drop the extra parameter and to use the
first element instead wouldn't be a big change, but these things
tend to add up, so unless this discussion immediately lead to a
future enhancement plan to make use of the flexibility the parameter
gives us, I'd rather see things kept simpler.
I do not terribly mind either way, either, though.
next prev parent reply other threads:[~2015-03-15 20:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-11 6:49 [PATCH v3 0/4] git-credential-store: XDG user-specific config file support Paul Tan
2015-03-11 6:49 ` [PATCH v3 1/4] git-credential-store: support multiple credential files Paul Tan
2015-03-13 6:15 ` Jeff King
2015-03-14 8:15 ` Paul Tan
2015-03-14 17:33 ` Jeff King
2015-03-14 17:42 ` Jeff King
2015-03-14 22:14 ` Junio C Hamano
2015-03-15 11:44 ` Matthieu Moy
2015-03-15 20:03 ` Junio C Hamano [this message]
2015-03-18 6:39 ` Paul Tan
2015-03-11 6:49 ` [PATCH v3 2/4] git-credential-store: support XDG_CONFIG_HOME Paul Tan
2015-03-11 6:49 ` [PATCH v3 3/4] docs/git-credential-store: document XDG file and precedence Paul Tan
2015-03-11 7:47 ` Eric Sunshine
2015-03-12 9:50 ` Paul Tan
2015-03-11 6:49 ` [PATCH v3 4/4] t0302: test credential-store support for XDG_CONFIG_HOME Paul Tan
2015-03-11 8:40 ` Eric Sunshine
2015-03-12 9:32 ` Paul Tan
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=xmqqy4myt4dt.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=Matthieu.Moy@grenoble-inp$(echo .)fr \
--cc=git@vger$(echo .)kernel.org \
--cc=peff@peff$(echo .)net \
--cc=pyokagan@gmail$(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