diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-09-18 14:24:06 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-18 14:24:06 -0700 |
commit | 8ffc33135268aaac55d08f4261d63b01b1004fb4 (patch) | |
tree | 760925cec62ba0c38e433900211425dfb402a88d /wrapper.c | |
parent | 01f7d7f19f585e40af399acc307200d4b6acad25 (diff) | |
parent | 8e950dab86eafa8f4ea671fab593ca6210bc2e15 (diff) | |
download | git-8ffc33135268aaac55d08f4261d63b01b1004fb4.tar.gz git-8ffc33135268aaac55d08f4261d63b01b1004fb4.tar.xz |
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
Diffstat (limited to 'wrapper.c')
-rw-r--r-- | wrapper.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -403,6 +403,19 @@ int remove_or_warn(unsigned int mode, const char *file) return S_ISGITLINK(mode) ? rmdir_or_warn(file) : unlink_or_warn(file); } +void warn_on_inaccessible(const char *path) +{ + warning(_("unable to access '%s': %s"), path, strerror(errno)); +} + +int access_or_warn(const char *path, int mode) +{ + int ret = access(path, mode); + if (ret && errno != ENOENT) + warn_on_inaccessible(path); + return ret; +} + struct passwd *xgetpwuid_self(void) { struct passwd *pw; |