Commit 158c8ba1ee81fe20d3beb16650f30f3be02054f7

Alan Rogers 2014-05-15T16:54:46

Return a specific error for EACCES.

diff --git a/include/git2/errors.h b/include/git2/errors.h
index e22f0d8..f09e725 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 e0b00a0..55790ff 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;