Skip to content

Commit

Permalink
feat: option to disable requiring git repository for git-ignore rules
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed Jun 22, 2023
1 parent f75a013 commit 410c625
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config/full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Global options: These options are used for all commands.
[global]
use-profile = []
use-profile = []
log-level = "info" # any of "off", "error", "warn", "info", "debug", "trace"; default: "info"
log-file = "/path/to/rustic.log" # Default: not set
no-progress = false
Expand Down Expand Up @@ -68,6 +68,7 @@ iglob = []
glob-file = []
iglob-file = []
git-ignore = false
no-require-git = false
exclude-if-present = [".nobackup", "CACHEDIR.TAG"] # Default: not set
one-file-system = false
exclude-larger-than = "100MB" # Default: not set
Expand Down Expand Up @@ -97,6 +98,7 @@ iglob = []
glob-file = []
iglob-file = []
git-ignore = false
no-require-git = false
exclude-if-present = [".nobackup", "CACHEDIR.TAG"] # Default: not set
one-file-system = false
exclude-larger-than = "100MB" # Default: not set
Expand Down
6 changes: 6 additions & 0 deletions crates/rustic_core/src/backend/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ pub struct LocalSourceFilterOptions {
#[cfg_attr(feature = "merge", merge(strategy = merge::bool::overwrite_false))]
git_ignore: bool,

/// Do not require a git repository to apply git_ignore rule
#[cfg_attr(feature = "clap", clap(long, help_heading = "Exclude options"))]
#[cfg_attr(feature = "merge", merge(strategy = merge::bool::overwrite_false))]
no_require_git: bool,

/// Exclude contents of directories containing this filename (can be specified multiple times)
#[cfg_attr(
feature = "clap",
Expand Down Expand Up @@ -177,6 +182,7 @@ impl LocalSource {
.hidden(false)
.ignore(false)
.git_ignore(filter_opts.git_ignore)
.require_git(!filter_opts.no_require_git)
.sort_by_file_path(Path::cmp)
.same_file_system(filter_opts.one_file_system)
.max_filesize(filter_opts.exclude_larger_than.map(|s| s.as_u64()))
Expand Down

0 comments on commit 410c625

Please sign in to comment.