Subject: [PATCH v2 0/4] git-credential-store: XDG user-specific config file support

From: Paul Tan <[email-masked]>
Date: Sun, 8 Mar 2015 15:58:48 +0800

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