Skip to content
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

feat: option to disable requiring git repository for git-ignore rules #698

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ New features:
- REST backend: Now allows to use custom TLS root certificates.
- restore: The restore algorithm has been improved and should now be faster for remote repositories.
- restore: Files are now allocated just before being first processed. This allows easier resumed restores.
- New option: `no-require-git` for backup - if enabled, a git repository is not required to apply `git-ignore` rule.
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