Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix symlinks for git annex #1

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

matrss
Copy link
Owner

@matrss matrss commented Feb 23, 2023

This PR implements the heuristic for better handling of symlinks as described in fsfe#627 (comment).

Basically, this is based on an interpretation of the REUSE specification that:

  1. a symlink pointing to a covered file is considered to be the same
    file as the covered file and can therefore be ignored.
  2. a symlink pointing to a file that is not a covered file is itself
    considered to be a covered file and should not be ignored, unless the
    symlink itself is ignored by other means.

@matrss matrss force-pushed the fix-symlinks-for-git-annex branch 4 times, most recently from 8b573e6 to 5208eda Compare February 23, 2023 16:01
@matrss matrss force-pushed the fix-symlinks-for-git-annex branch 9 times, most recently from 73589f5 to 9ae09f6 Compare June 19, 2023 10:19
matrss added 4 commits June 22, 2023 11:19
Previously a sub-path of an ignored directory was not considered to be
ignored, e.g. is_ignored returned False for a file build/hello.py even
if _all_ignored_files contained Path("build").  Instead of just checking
if the path is in the ignored files we also have to check if it is
inside of an ignored directory.

Additionally this commit fixes a bug that surfaced: when building the
_all_ignored_files set all_files contains an empty string as its last
element. This leads to Path(".") being an element in _all_ignored_files,
i.e. ignore everything. Using all but the last element from all_files
fixes that.
These tests assume the interpretation of the REUSE specification that:
1. a symlink pointing to a covered file is considered to be the same
   file as the covered file and can therefore be ignored.
2. a symlink pointing to a file that is not a covered file is itself
   considered to be a covered file and should not be ignored, unless the
   symlink itself is ignored by other means.
@matrss matrss force-pushed the fix-symlinks-for-git-annex branch from 9ae09f6 to fbb5ed2 Compare June 22, 2023 09:20
@matrss matrss force-pushed the fix-symlinks-for-git-annex branch from fbb5ed2 to 13e4fa7 Compare June 22, 2023 09:27
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.

1 participant