git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 1/4] git-credential-store: support multiple credential files

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Mar 15, 2015, 11:44 UTC
Message-ID
<vpqbnju7aex.fsf@anie.imag.fr>
In-Reply-To
<xmqqfv97w7k5.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 16 quoted lines
> 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, 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.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 17 in “git-credential-store: XDG user-specific config file support”
  1. 0/4 git-credential-store: XDG user-specific config file supportPaul Tan, Mar 11, 2015
  2. 1/4 git-credential-store: support multiple credential filesPaul Tan, Mar 11, 2015
  3. Jeff KingMar 13, 2015
  4. Paul TanMar 14, 2015
  5. Jeff KingMar 14, 2015
  6. Jeff KingMar 14, 2015
  7. Junio C HamanoMar 14, 2015
  8. Matthieu MoyMar 15, 2015
  9. Junio C HamanoMar 15, 2015
  10. Paul TanMar 18, 2015
  11. 2/4 git-credential-store: support XDG_CONFIG_HOMEPaul Tan, Mar 11, 2015
  12. 3/4 docs/git-credential-store: document XDG file and precedencePaul Tan, Mar 11, 2015
  13. Eric SunshineMar 11, 2015
  14. Paul TanMar 12, 2015
  15. 4/4 t0302: test credential-store support for XDG_CONFIG_HOMEPaul Tan, Mar 11, 2015
  16. Eric SunshineMar 11, 2015
  17. Paul TanMar 12, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.