git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Tan <pyokagan@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Jeff King <peff@peff.net>, Paul Tan <pyokagan@gmail.com>
Subject: [PATCH v2 0/4] git-credential-store: XDG user-specific config file support
Date: Sun,  8 Mar 2015 15:58:48 +0800	[thread overview]
Message-ID: <1425801532-8483-1-git-send-email-pyokagan@gmail.com> (raw)

The previous patch series can be found at [1].

[1] http://thread.gmane.org/gmane.comp.version-control.git/264682

The changes are as follows:

* Code refactor: instead of a gigantic blob of code in main(),
  store_credential(), remove_credential() and lookup_credential() have been
  modified to take a string_list of precedence-ordered file paths. Although in
  this patch only support for XDG_CONFIG_HOME (user-specific config files) are
  implemented, this opens the door for support of XDG_CONFIG_DIRS (system-wide
  config files) to be implemented as well.

* parse_credential_file() returns the value of found_credential at all times.
  (Thanks Junio for pointing this out)

* parse_credential_file(), and thus "get" ignores unreadable/non-existing files
  instead of warning the user. This is done to follow the XDG base dir spec,
  which states that: "if for any reason a file in a certain directory is
  unaccessible, e.g. because the directory is non-existant, the file is
  non-existant or the user is not authorized to open the file, then the
  processing of the file in that directory should be skipped."[2]

[2] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

* "store" now only write to a single file instead of writing to one and erasing
  from the rest, unlike the behavior in the 1st patch, as the complexity
  introduced by implementing this behavior is probably unnecessary. If the user
  really wanted all matching credentials to be erased, the user can simply just
  issue an erase. (Thanks Matthieu, Junio and Jeff for this suggestion)

* ~/.git-credentials now has greater precedence than the xdg credentials file.
  This is to be consistent with the behavior of git-config.

* Support for $XDG_CONFIG_HOME/git/credentials has been documented in
  git-credentials-store.

The changes for the tests are as follows:

* Instead of repeating ${XDG_CONFIG_HOME:-$HOME/.config} all over
  the place, add tests that test for $HOME/.config/git/credentials (when
  XDG_CONFIG_HOME is unset) and for $XDG_CONFIG_HOME/git/credentials with a
  custom $XDG_CONFIG_HOME directory set. This is to test that the new code
  respects the $XDG_CONFIG_HOME environment variable. (Thanks Junio)

* Use test_path_is_missing to test if files exist. (Thanks Matthieu)

* All code is now within test_expect_success and will now fail if any
  error occurs in the code block through the use of "&&". Furthermore, tests do
  not rely on previous tests passing as the credential files are overwritten in
  each test. (Thanks Matthieu and Junio for your code review)

The most current version of the patch queue is published in the xdg branch
at [3]. I try to push -f regularly.

For your feedback, please.

[3] https://github.com/pyokagan/git

Paul Tan (4):
  git-credential-store: support multiple credential files
  git-credential-store: support XDG_CONFIG_HOME
  docs/git-credential-store: document XDG file and precedence
  t0302: test credential-store support for XDG_CONFIG_HOME

 Documentation/git-credential-store.txt | 37 +++++++++++++-
 credential-store.c                     | 86 +++++++++++++++++++++----------
 t/t0302-credential-store.sh            | 92 ++++++++++++++++++++++++++++++++++
 3 files changed, 186 insertions(+), 29 deletions(-)

-- 
2.1.4

             reply	other threads:[~2015-03-08  7:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08  7:58 Paul Tan [this message]
2015-03-08  7:58 ` [PATCH v2 1/4] git-credential-store: support multiple credential files Paul Tan
2015-03-08  7:58 ` [PATCH v2 2/4] git-credential-store: support XDG_CONFIG_HOME Paul Tan
2015-03-10 13:43   ` Paul Tan
2015-03-08  7:58 ` [PATCH v2 3/4] docs/git-credential-store: document XDG file and precedence Paul Tan
2015-03-08  7:58 ` [PATCH v2 4/4] t0302: test credential-store support for XDG_CONFIG_HOME Paul Tan
2015-03-09 12:36   ` Matthieu Moy
2015-03-10 13:55     ` 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=1425801532-8483-1-git-send-email-pyokagan@gmail.com \
    --to=pyokagan@gmail.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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).