summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-05-07 17:25:16 +0200
committernulltoken <emeric.fermas@gmail.com>2012-05-08 10:05:24 +0200
commit464cf248fd05f76cd377298b98b82132c9088569 (patch)
tree768c2884aa87e652bcf7a272942cb322c100ca84 /src
parent0b0957a66109b545ded7332591b4fcb8f7e13fd0 (diff)
downloadlibgit2-464cf248fd05f76cd377298b98b82132c9088569.tar.gz
repository: ensure git_repository_discover() returns ENOTFOUND when unable to find a repository given the constraints
Diffstat (limited to 'src')
-rw-r--r--src/repository.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/repository.c b/src/repository.c
index d4de38104..ea9673731 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -397,13 +397,14 @@ int git_repository_discover(
{
git_buf path = GIT_BUF_INIT;
uint32_t flags = across_fs ? GIT_REPOSITORY_OPEN_CROSS_FS : 0;
+ int error;
assert(start_path && repository_path && size > 0);
*repository_path = '\0';
- if (find_repo(&path, NULL, start_path, flags, ceiling_dirs) < 0)
- return -1;
+ if ((error = find_repo(&path, NULL, start_path, flags, ceiling_dirs)) < 0)
+ return error != GIT_ENOTFOUND ? -1 : error;
if (size < (size_t)(path.size + 1)) {
giterr_set(GITERR_REPOSITORY,