mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 20:33:41 +00:00
diriter: don't double '/' on posix
The canonical directory path of the root directory of a volume on POSIX already ends in a slash (eg, `/`). This is true only at the root. Do not add a slash to paths in this case.
This commit is contained in:
parent
5a466befaf
commit
9d905541bf
@ -1319,7 +1319,11 @@ int git_path_diriter_next(git_path_diriter *diriter)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
git_buf_truncate(&diriter->path, diriter->parent_len);
|
git_buf_truncate(&diriter->path, diriter->parent_len);
|
||||||
git_buf_putc(&diriter->path, '/');
|
|
||||||
|
if (diriter->parent_len > 0 &&
|
||||||
|
diriter->path.ptr[diriter->parent_len-1] != '/')
|
||||||
|
git_buf_putc(&diriter->path, '/');
|
||||||
|
|
||||||
git_buf_put(&diriter->path, filename, filename_len);
|
git_buf_put(&diriter->path, filename, filename_len);
|
||||||
|
|
||||||
if (git_buf_oom(&diriter->path))
|
if (git_buf_oom(&diriter->path))
|
||||||
|
Loading…
Reference in New Issue
Block a user