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

Allow ignore/unignore rules in .ignore #931

Merged
merged 1 commit into from
Aug 14, 2024
Merged

Allow ignore/unignore rules in .ignore #931

merged 1 commit into from
Aug 14, 2024

Conversation

Canop
Copy link
Owner

@Canop Canop commented Aug 13, 2024

Files called .ignore with the syntax of gitignore files are now read and used just like .gitignore files.

When, at the same level, broot finds rules from both a .ignore and a .gitignore files, the .ignore is the decisive one (it's assumed to be personal and meant to override the shared .gitignore file.

Eg I can have a global .gitignore file with

dys-notes.*

which helps me have notes everywhere and not sharing them.

And I can have a .ignore file, which reveals some of those files in broot:

!dys-notes.md 

Fix #613

@FrancescElies
Copy link
Contributor

tests

  1. ✅ broot_*zip.
    Image: upper-left (fd), bottom-left: broot, upper-right: .ignore, bottom-right: .gitignore grafik

  2. ✅ Here I was expecting the zip file releases/broot_/broot_.zip to appear in broot but then I realized fd was behaving the same way, I had wrong expectations.
    Image: upper-left (fd), bottom-left: broot, upper-right: .ignore, bottom-right: .gitignore grafik

  3. ✅I did the same test as you described above.
    Image: upper-left (fd), bottom-left: broot, upper-right: .ignore, bottom-right: .gitignore grafik

@Canop
Copy link
Owner Author

Canop commented Aug 14, 2024

Thanks for the tests and detailed report!

Regarding the 2: it's because when you ignore releases, you don't even have a look at what's inside.

@Canop
Copy link
Owner Author

Canop commented Aug 14, 2024

In the current implementation, when you're inside a git repository, .ignore files outside this repository aren't taken into account.

This mimics the behavior which was defined for git, but there are use cases which are thus not supported.

@Canop Canop merged commit 73d0ca8 into main Aug 14, 2024
1 check passed
@Canop Canop deleted the ignore branch August 14, 2024 16:47
@FrancescElies
Copy link
Contributor

For the time being it’s ok, you can add those afterwards when there is enough people begging for those missing features.

By the way it was so nice to see that being added to broot with such a small patch 🤩

@Canop
Copy link
Owner Author

Canop commented Aug 14, 2024

I'm currently adding those feature, after reflexion.

I want to support the case of having dys-notes.* always gitnored and always unignored, with only global files.

@Canop
Copy link
Owner Author

Canop commented Aug 14, 2024

@FrancescElies I made #932

(I'll test it more but your opinion would of course be welcome)

@Canop
Copy link
Owner Author

Canop commented Aug 15, 2024

Merged. Documentation has been improved: https://dystroy.org/broot/tree_view/#hidden-ignored-files

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.

Ignore files without using .gitignore (.brootignore? .ignore?)
2 participants