Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-11-19 22:00:46 +0400
committernulltoken <emeric.fermas@gmail.com>2012-12-01 11:34:31 +0400
commitcc1466264a385419aa4ebc3811846b038b3430d1 (patch)
treed3d9a6da47a845044a9c5b39f6b4920bd15b2740 /src/errors.c
parent84166facc9537a03d8aaaa415c9e8044d0239252 (diff)
revparse: Deploy EINVALIDSPEC usage
Diffstat (limited to 'src/errors.c')
-rw-r--r--src/errors.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/errors.c b/src/errors.c
index ac7fa934d..e62507216 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -93,11 +93,18 @@ void giterr_set_str(int error_class, const char *string)
set_error(error_class, message);
}
-void giterr_set_regex(const regex_t *regex, int error_code)
+int giterr_set_regex(const regex_t *regex, int error_code)
{
char error_buf[1024];
regerror(error_code, regex, error_buf, sizeof(error_buf));
giterr_set_str(GITERR_REGEX, error_buf);
+
+ if (error_code == REG_NOMATCH)
+ return GIT_ENOTFOUND;
+ else if (error_code > REG_BADPAT)
+ return GIT_EINVALIDSPEC;
+ else
+ return -1;
}
void giterr_clear(void)