mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-02 20:52:13 +00:00
attr: Do not walk path if we're at the root
This commit is contained in:
parent
4cb7c4a4c7
commit
a2b4407dc3
13
src/attr.c
13
src/attr.c
@ -422,10 +422,8 @@ static int collect_attr_files(
|
||||
/* Resolve path in a non-bare repo */
|
||||
if (workdir != NULL)
|
||||
error = git_path_find_dir(&dir, path, workdir);
|
||||
/* when in a bare repo, find the containing folder if the given
|
||||
* path is a subfolder (if not, the containing folder is the root) */
|
||||
else if (strchr(path, '/') != NULL)
|
||||
error = git_path_dirname_r(&dir, path);
|
||||
else
|
||||
error = git_path_dirname_r(&dir, path);
|
||||
if (error < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -449,7 +447,12 @@ static int collect_attr_files(
|
||||
giterr_clear(); /* no error even if there is no index */
|
||||
info.files = files;
|
||||
|
||||
error = git_path_walk_up(&dir, workdir, push_one_attr, &info);
|
||||
if (!strcmp(dir.ptr, ".")) {
|
||||
error = push_one_attr(&info, "");
|
||||
} else {
|
||||
error = git_path_walk_up(&dir, workdir, push_one_attr, &info);
|
||||
}
|
||||
|
||||
if (error < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user