From 158c8ba1ee81fe20d3beb16650f30f3be02054f7 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Thu, 15 May 2014 16:54:46 +1000 Subject: [PATCH] Return a specific error for EACCES. --- include/git2/errors.h | 1 + src/path.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/git2/errors.h b/include/git2/errors.h index e22f0d86d..f09e72566 100644 --- a/include/git2/errors.h +++ b/include/git2/errors.h @@ -41,6 +41,7 @@ typedef enum { GIT_EMERGECONFLICT = -13, /*< Merge conflicts prevented operation */ GIT_ELOCKED = -14, /*< Lock file prevented operation */ GIT_EMODIFIED = -15, /*< Reference value does not match expected */ + GIT_ENOACCESS = -16, /*< Access denied attempting operation */ GIT_PASSTHROUGH = -30, /*< Internal only */ GIT_ITEROVER = -31, /*< Signals end of iteration with iterator */ diff --git a/src/path.c b/src/path.c index e0b00a086..55790ff7c 100644 --- a/src/path.c +++ b/src/path.c @@ -561,6 +561,10 @@ int git_path_set_error(int errno_value, const char *path, const char *action) giterr_set(GITERR_OS, "Failed %s - '%s' already exists", action, path); return GIT_EEXISTS; + case EACCES: + giterr_set(GITERR_OS, "Failed %s - '%s' permission denied", action, path); + return GIT_ENOACCESS; + default: giterr_set(GITERR_OS, "Could not %s '%s'", action, path); return -1;