Skip to content
Open
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
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ anyhow = "1.0.100"
whoami = "2"
uuid = "1.20.0"
zstd = "0.13.3"
globset = "0.4"
regex = "1"
2 changes: 2 additions & 0 deletions dvs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jiff.workspace = true
anyhow.workspace = true
whoami.workspace = true
zstd.workspace = true
globset.workspace = true
regex.workspace = true
uuid = { version = "1.20.0", features = ["v4"] }

[target.'cfg(unix)'.dependencies]
Expand Down
8 changes: 8 additions & 0 deletions dvs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::path::Path;
use crate::backends::Backend as BackendTrait;
use crate::backends::local::LocalBackend;
use crate::paths::{CONFIG_FILE_NAME, DEFAULT_FOLDER_NAME, find_repo_root};
use crate::tracking_rules::TrackingRule;
use anyhow::{Context, Result};
use fs_err as fs;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -72,6 +73,8 @@ pub struct Config {
/// If this option is set, dvs will use that folder name instead of `.dvs`
metadata_folder_name: Option<String>,
backend: Backend,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
tracking_rules: Vec<TrackingRule>,
}

impl Config {
Expand All @@ -85,6 +88,7 @@ impl Config {
compression: Compression::Zstd,
metadata_folder_name: None,
backend: Backend::Local(backend),
tracking_rules: Vec::new(),
})
}

Expand Down Expand Up @@ -135,6 +139,10 @@ impl Config {
self.compression = compression;
}

pub fn tracking_rules(&self) -> &[TrackingRule] {
&self.tracking_rules
}

pub fn backend(&self) -> &dyn BackendTrait {
match &self.backend {
Backend::Local(b) => b,
Expand Down
2 changes: 2 additions & 0 deletions dvs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ mod gitignore;
mod hashes;
pub mod init;
pub mod paths;
pub mod tracking_rules;

pub use backends::Backend;
pub use config::Compression;
pub use file::{AddResult, FileMetadata, FileStatus, GetResult, Outcome, Status};
pub use file::{add_files, get_files, get_status};
pub use hashes::{HashAlg, Hashes};
pub use paths::{DvsPaths, find_repo_root};
pub use tracking_rules::TrackingRule;

#[cfg(test)]
pub mod testutil {
Expand Down
Loading