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
Add ability to exclude files through .gitignore #4227
base: master
Are you sure you want to change the base?
Conversation
It first uses the go-git package to parse the .gitignore files in each target and create a matcher object, then uses it to determine wether a file/directory/symlink should be included based on its path
I do humbly apologise for the ping. Is there any way you could find the time to take a look at this pull request? The author has expressed their intent to work on it, if this feature is deemed useful. I fully understand how much work maintaining open source software can be, and wouldn't ask for anything more than a quick look and response. On that note, thank you very much for maintaining my favourite backup utility. |
I've already taken a quick glance at the PR and realized that I'll have to think quite a bit about it's design. In particular, I'm not convinced that it is a good idea to load all gitignores when starting the backup and the code also pulls in a pretty large number of new dependencies. As addressing these concerns requires quite a significant amount of changes, I'd like to think about it for some time before asking for such changes. The I'll be pretty short on time towards the end of the year, such that I probably won't have time this year to take a closer look. |
What does this PR change? What problem does it solve?
This PR is a first attempt to add the ability for restic to use
.gitignore
files to exclude entities from the backups.Specifically, it defines a new flag,
--exclude-gitignored
, that can be used to enable the feature.I tested this on linux and appears to work, but expect that I'll need to make more changes to ensure it functions cross-platforms and fits the style of the repo before merging. Looking forward for discussing this.
I used the gitignore parser provided by the
go-git
package.Was the change previously discussed in an issue or on the forum?
This PR is related to issue #1514. (not sure if it can be considered as solved once it is merged since the conversation would also consider other VCSs as alternatives)
Known Issues
See issues 694 and 154.
Mentioning this in the docs may be enough to warn the users. Alternatively, we could consider another package for parsing the .gitignores
Checklist
changelog/unreleased/
that describes the changes for our users (see template).gofmt
on the code in all commits.