re: patterns not accepted for prune
Have you checked borgbackup docs, FAQ, and open Github issues?
Yes
Is this a BUG / ISSUE report or a QUESTION?
Maybe either.
Borg 1.11
It seems like re: patterns are not accepted for the --glob--archives option of prune.
It is not clear from the documentation whether this is by design. The doc says "sh: rules apply, see “borg help patterns”", but the pattern help indicates you can override the default using the various prefixes.
It would be nice to support re: patterns as they are the only way I can see of excluding some archives from pruning (unless the archive naming happens to work out for a "positive" glob). E.g., I want to keep my oldest archive, and I could do that using --glob--archives with a re: pattern and negative lookaround.
Well, guess this is by design. And if it says "sh: rules apply", that does not imply that you can use the other patterns also.
But I see your point, so maybe this could be generalized (sh: would need to stay the default, of course).
PRs welcome.
Seems to be by design, but maybe allowing the other patterns can be a good idea as well? I can do this, I have started looking at the code in order to understand the logic and be more efficient if I have to work on this section of the code
@Gu1nness PRs welcome. Try to reuse code from existing patterns matching, if possible.
Hi, I am looking to start contributing to open source projects and I was wondering if I can pick this one - if it's still open for grabs. Thanks!
@preetisi sure, it is still open. maybe first think about how to solve it best, discuss it here, implement tests + code, do a PR early.
So from my understanding:
Rather than having a --patterns-from option for example, prune gets --glob-archives from define_archive_filters_group. Since the type is GlobSpec, this implies that only sh: rules apply (makes sense since it's globbing). If we were to allow re: and other patterns in prune, then it would make sense to replace glob-archives with pattern is my thinking? Would bring it more in line with other commands at the cost of backwards incompatibility.
Yeah, naming it "glob-..." when not (only) doing globbing is maybe a bit strange.
As we'll break some stuff anyway in borg2, we could also rename that. Guess that would be good also considering that "glob..." is a rather technical term.
How about --match-archives as long version of -a, supporting prefixes like re:, sh:, etc. and defaulting to globbing?
see #7028.
Thanks @ThomasWaldmann - your dedication to this free product is much appreciated!