Support patterns-from #49

Closed
opened 2018-01-09 13:35:33 +00:00 by TiGR · 9 comments

Borg has an option patterns-from that lets you specify file with include/exclude patterns. Could borgmatic have it also? Or could borgmatic have any option to let you pass any option you want to borg create?

Borg has an option `patterns-from` that lets you specify file with include/exclude patterns. Could borgmatic have it also? Or could borgmatic have any option to let you pass any option you want to `borg create`?
Owner

borgmatic already supports "native" exclude_patterns and exclude_from config options. Do you want to use Borg's patterns-from because you also need to specify includes and not just excludes? The Borg feature is marked experimental, so I haven't implemented it yet, but I can imagine why it'd be useful. Out of curiosity, what do you want to use it for?

Thanks!

borgmatic already supports "native" `exclude_patterns` and `exclude_from` config options. Do you want to use Borg's `patterns-from` because you also need to specify includes and not just excludes? The Borg feature is marked experimental, so I haven't implemented it yet, but I can imagine why it'd be useful. Out of curiosity, what do you want to use it for? Thanks!
Author

I'm trying to create something to ignore files that are ignored in .gitignore files found in backup files. So, I have these lines in my config:

source_directories:
    - /files/to/backup
location:
    exclude_from:
        - /files/to/backup/.borgmatic-exclude
hooks:
    before_backup:
        - echo "`date` - Starting a backup job."
        - find /files/to/backup/ -name .gitignore | grep -v /vendor/ | xargs grep -HPv '^([!#]|$)' | sed -E 's~\.gitignore:([^/])~**/\1~' | sed 's~\.gitignore:/~~' | sed 's/^/sh:/' > /files/to/backup/.borgmatic-exclude

It is quick and dirty, but it works. The only problem is that I have to ignore not-exclude patterns from .gitignore as there is no way to specify these in --exclude-from. That's why I need --patterns-from.

I'm trying to create something to ignore files that are ignored in `.gitignore` files found in backup files. So, I have these lines in my config: ```yaml source_directories: - /files/to/backup location: exclude_from: - /files/to/backup/.borgmatic-exclude hooks: before_backup: - echo "`date` - Starting a backup job." - find /files/to/backup/ -name .gitignore | grep -v /vendor/ | xargs grep -HPv '^([!#]|$)' | sed -E 's~\.gitignore:([^/])~**/\1~' | sed 's~\.gitignore:/~~' | sed 's/^/sh:/' > /files/to/backup/.borgmatic-exclude ``` It is quick and dirty, but it works. The only problem is that I have to ignore not-exclude patterns from `.gitignore` as there is no way to specify these in `--exclude-from`. That's why I need `--patterns-from`.
Owner

Makes sense.. Thanks for clarifying the need and including the work-around example!

Makes sense.. Thanks for clarifying the need and including the work-around example!
Owner

Just implemented this in master via new patterns_from and patterns configuration options in borgmatic. It'll be part of the next release. I'll be interested to hear how it works out for your use case.

Just implemented this in master via new `patterns_from` and `patterns` configuration options in borgmatic. It'll be part of the next release. I'll be interested to hear how it works out for your use case.
Owner

borgmatic 1.1.13 was just released with this.

borgmatic 1.1.13 was just released with this.
Author

Well, borgmatic fails with

borg: error: unrecognized arguments: --pattern-from /files/to/backup/.borgmatic-patterns

I suppose the problem is that the argument name is patterns-from, not pattern-from.

Well, borgmatic fails with borg: error: unrecognized arguments: --pattern-from /files/to/backup/.borgmatic-patterns I suppose the problem is that the argument name is `patterns-from`, not `pattern-from`.
TiGR reopened this issue 2018-01-15 11:08:25 +00:00
Author

There are 6 instances of pattern-from in b8f6bab12d

There are 6 instances of `pattern-from` in b8f6bab12d
Owner

My bad, will fix!

My bad, will fix!
Owner

Okay, fixed and released in borgmatic 1.1.14.

Okay, fixed and released in borgmatic 1.1.14.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#49
No description provided.