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 filenignore behavior for directories #57

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

szapp
Copy link
Contributor

@szapp szapp commented Dec 11, 2024

As by gitignore syntax, directories are differentiated from files by specifying a trailing slash.

any_directory/
any_file
/specific/directory/
/specific/file

Filen's sync does not meet these specifications and fails to match entries with trailing slash. Instead, for the example above, Filen would not ignore the directories until removing the trailing slash. Although seemingly not a big problem, it is not the gititnore behavior and may lead to confusion and frustration.

The reason is laid out in the README ("2. filenames and dirnames") of the used package ignore: The package cannot tell files and directories apart given the file path as simple string and requires a trailing slash to do so.

Here, I attempted to remedy this behavior at the relevant portions in the code that I could find by passing a trailing slash to the ignores function. Most likely that is not done in the most performant and elegant way. Nevertheless, I hope it will inspire to address this minor issue.

@Dwynr
Copy link
Member

Dwynr commented Dec 12, 2024

LGTM, will run it on a separate branch before merging (+ make it a bit more peformant). Thanks!

@Dwynr Dwynr merged commit 8a59d1f into FilenCloudDienste:main Dec 13, 2024
4 checks passed
@szapp szapp deleted the ignore-directory branch December 14, 2024 09:04
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