Skip to content

Fix matching of absolute paths in --include#3976

Merged
hauntsaninja merged 9 commits intopsf:mainfrom
sth:sth/include-absolute-path
Oct 27, 2023
Merged

Fix matching of absolute paths in --include#3976
hauntsaninja merged 9 commits intopsf:mainfrom
sth:sth/include-absolute-path

Conversation

@sth
Copy link
Copy Markdown
Contributor

@sth sth commented Oct 24, 2023

Description

This is a fix for #3975.

It modifies normalized_path in the way it was done before #3846, so that the check for included files still matches the same files.

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 24, 2023

diff-shades reports zero changes comparing this PR (3cb0639) to main (7bfa35c).


What is this? | Workflow run | diff-shades documentation

Copy link
Copy Markdown
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this and opening a PR! I think we should use root_relative_path on L396 , so we apply include logic before symlink resolution

@sth
Copy link
Copy Markdown
Contributor Author

sth commented Oct 26, 2023

I agree it makes sense to check include and exclude against the same type of path and not use resolved symlinks for one and unresolved symlinks for the other.

It now checks the path with unresolved symlinks against includes and excludes and the symlink target is not checked this way (but it is still checked if is under the root dir).

I also added is_dir and is_file to all the mocks in the symlink testcase, since if the items aren't files they won't be included no matter the name.

Copy link
Copy Markdown
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@hauntsaninja hauntsaninja merged commit c369e44 into psf:main Oct 27, 2023
@sth sth deleted the sth/include-absolute-path branch February 26, 2025 12:57
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.

2 participants