Visitar URL original
index: reject paths beyond a symbolic link by r3wretrhy · Pull Request #7381 · libgit2/libgit2 · GitHub
Skip to content

index: reject paths beyond a symbolic link - #7381

Open
r3wretrhy wants to merge 1 commit into
libgit2:mainfrom
r3wretrhy:index-reject-symlink-path
Open

r3wretrhy wants to merge 1 commit into
libgit2:mainfrom
r3wretrhy:index-reject-symlink-path

Conversation

@r3wretrhy

Copy link
Copy Markdown

git_index_add_bypath accepts a path whose non-final component is a symlink (linkdir/file.txt when linkdir → realdir). git add refuses that pathspec, because staging it produces a tree git cannot check out next to the symlink.

Walk each prefix of the workdir path and fail when a prefix is a symlink. Adding the symlink itself is unchanged.

test_index_bypath__add_rejects_path_beyond_symlink covers the rejection and the still-valid git_index_add_bypath(..., "linkdir") case.

Fixes #7380.

git add refuses a pathspec whose non-final component is a symlink. Staging such a path produces a tree git cannot check out next to the symlink.

Walk each prefix of the workdir path and fail when a prefix is a symlink. Adding the symlink itself is unchanged.

Fixes libgit2#7380

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git_index_add_bypath accepts a path beyond a symbolic link, where git add refuses

1 participant