Repository: Fixed some errors with ceiling_dirs in git_repository_discover. Now the ceiling_dirs are compared with their symbolic free version (like base_path). The ceiling dirs check is now performed after getting the parent directory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/src/repository.c b/src/repository.c
index 0b67d14..cae43dc 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -369,8 +369,7 @@ static int retrieve_ceiling_directories_offset(const char *path, const char *cei
strncpy(buf, ceil, len);
buf[len] = '\0';
- gitfo_posixify_path(buf);
- if (gitfo_prettify_dir_path(buf2, sizeof(buf2), buf, NULL) < GIT_SUCCESS)
+ if (abspath(buf2, sizeof(buf2), buf) < GIT_SUCCESS)
continue;
len = strlen(buf2);
@@ -521,12 +520,6 @@ int git_repository_discover(char *repository_path, size_t size, const char *star
git_repository__free_dirs(&repo);
- //nothing has been found, lets try the parent directory
- if (bare_path[ceiling_offset] == '\0') {
- error = git__throw(GIT_ENOTAREPO,"Not a git repository (or any of the parent directories): %s", start_path);
- goto cleanup;
- }
-
if (git__dirname_r(normal_path, sizeof(normal_path), bare_path) < GIT_SUCCESS)
goto cleanup;
@@ -547,6 +540,13 @@ int git_repository_discover(char *repository_path, size_t size, const char *star
strcpy(bare_path, normal_path);
git__joinpath(normal_path, bare_path, DOT_GIT);
+
+ //nothing has been found, lets try the parent directory
+ if (bare_path[ceiling_offset] == '\0') {
+ error = git__throw(GIT_ENOTAREPO,"Not a git repository (or any of the parent directories): %s", start_path);
+ goto cleanup;
+ }
+
}
if (size < (strlen(found_path) + 1) * sizeof(char)) {