Merge branch 'jk/config-warn-on-inaccessible-paths' into maint

The attribute system may be asked for a path that itself or its
leading directories no longer exists in the working tree, and it is
fine if we cannot open .gitattribute file in such a case.  Failure
to open per-directory .gitattributes with error status other than
ENOENT and ENOTDIR should be diagnosed.

* jk/config-warn-on-inaccessible-paths:
  attr: failure to open a .gitattributes file is OK with ENOTDIR
  warn_on_inaccessible(): a helper to warn on inaccessible paths
  attr: warn on inaccessible attribute files
  gitignore: report access errors of exclude files
  config: warn on inaccessible files
This commit is contained in:
Junio C Hamano
2012-09-18 14:24:06 -07:00
6 changed files with 34 additions and 10 deletions

View File

@ -400,8 +400,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
*/
die("$HOME not set");
if (access(user_config, R_OK) &&
xdg_config && !access(xdg_config, R_OK))
if (access_or_warn(user_config, R_OK) &&
xdg_config && !access_or_warn(xdg_config, R_OK))
given_config_file = xdg_config;
else
given_config_file = user_config;