mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 16:22:40 +00:00
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.
This commit is contained in:
parent
fd0574e5ad
commit
9d9bab5c38
@ -369,8 +369,7 @@ static int retrieve_ceiling_directories_offset(const char *path, const char *cei
|
|||||||
strncpy(buf, ceil, len);
|
strncpy(buf, ceil, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
gitfo_posixify_path(buf);
|
if (abspath(buf2, sizeof(buf2), buf) < GIT_SUCCESS)
|
||||||
if (gitfo_prettify_dir_path(buf2, sizeof(buf2), buf, NULL) < GIT_SUCCESS)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
len = strlen(buf2);
|
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);
|
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)
|
if (git__dirname_r(normal_path, sizeof(normal_path), bare_path) < GIT_SUCCESS)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -547,6 +540,13 @@ int git_repository_discover(char *repository_path, size_t size, const char *star
|
|||||||
|
|
||||||
strcpy(bare_path, normal_path);
|
strcpy(bare_path, normal_path);
|
||||||
git__joinpath(normal_path, bare_path, DOT_GIT);
|
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)) {
|
if (size < (strlen(found_path) + 1) * sizeof(char)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user