Skip to content

Cannot combine backup.globs and snapshot-specific globs #1647

@fvsch

Description

@fvsch

Here is an example config:

[backup]
globs = ["!.DS_Store", "!._*", "!.DocumentRevisions-*", "!.Spotlight-*", "!.TemporaryItems", "!.Trashes", "!.fseventsd"]

[[backup.snapshots]]
name = "Dotfiles"
sources = ["/Users/me/.config"]
globs = ["!*.sock", "!history.txt"]

When backing up files from ~/.config, the backup.globs config is ignored, because it's overridden by the globs list in the Dotfiles snapshot definition. So a file like ~/.config/foo/.DS_Store will be backed up.

I expected both lists of globs to be considered (i.e. merging the two lists), but it looks like one overrides the other.

I don’t know if that’s a bug. Probably not? It was a bit unintuitive for me, but it kinda makes sense. If the lists were magically merged, then it would be impossible to override backup.globs when you actually want to.

The workarounds I’ve found all rely on using different options to define excludes at the global and snapshot-specific level:

  • Use backup.iglobs for shared rules, and globs for specific snapshots.
  • Use backup.glob-files for shared rules, and globs or iglobs for specific snapshots.
  • Use backup.globs for shared rules, and .backupignore files in the source folders for specific snapshots.
  • etc.

I don't know if there's anything to do here. It was a bit of a gotcha for me, so I thought I'd raise the issue, but I’m okay with closing it if no one has an idea for improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-triageStatus: Waiting for a maintainer to triage this issue/PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions