From f84dd81704603cf9b5abf5f67ec979b01ea3dc2b Mon Sep 17 00:00:00 2001 From: Jiji Freya Daniel Maslowski Date: Tue, 29 Sep 2026 16:23:17 +0200 Subject: [PATCH 1/2] core/commands/backup: tidy up type parameters Signed-off-by: Jiji Freya Daniel Maslowski --- crates/core/src/commands/backup.rs | 33 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/crates/core/src/commands/backup.rs b/crates/core/src/commands/backup.rs index 31aaf79be..823d12a48 100644 --- a/crates/core/src/commands/backup.rs +++ b/crates/core/src/commands/backup.rs @@ -83,8 +83,7 @@ impl ParentOptions { /// /// # Type Parameters /// - /// * `P` - The type of the progress bars. - /// * `S` - The type of the indexed tree. + /// * `R` - The type of the indexed tree (repository). /// /// # Arguments /// @@ -94,9 +93,9 @@ impl ParentOptions { /// # Returns /// /// The parent snapshot ids and the parent object. - pub(crate) fn get_parent( + pub(crate) fn get_parent( &self, - repo: &Repository, + repo: &Repository, snap: &SnapshotFile, ) -> (Vec, Parent) { let group = SnapshotGroup::from_snapshot(snap, self.group_by.unwrap_or_default()); @@ -197,12 +196,12 @@ pub struct BackupOptions { pub ignore_filter_opts: LocalSourceFilterOptions, } -/// Backup data, create a snapshot. +/// Archive data, create a snapshot. /// /// # Type Parameters /// -/// * `P` - The type of the progress bars. -/// * `S` - The type of the indexed tree. +/// * `R` - The type of the indexed IDs (repository). +/// * `S` - The type of the backup source. /// /// # Arguments /// @@ -222,18 +221,18 @@ pub struct BackupOptions { /// # Returns /// /// The snapshot pointing to the backup'ed data. -pub(crate) fn archive( - repo: &Repository, +pub(crate) fn archive( + repo: &Repository, opts: &BackupOptions, - src: &R, + src: &S, mut snap: SnapshotFile, backup_paths: &[PathBuf], ) -> RusticResult where - S: IndexedIds, - R: ReadSource + 'static, - ::Open: Send, - ::Iter: Send, + R: IndexedIds, + S: ReadSource + 'static, + ::Open: Send, + ::Iter: Send, { let index = repo.index(); @@ -301,7 +300,7 @@ where /// /// # Type Parameters /// -/// * `S` - The type of the indexed tree. +/// * `R` - The type of the indexed IDs (repository). /// /// # Arguments /// @@ -321,8 +320,8 @@ where /// # Returns /// /// The snapshot pointing to the backup'ed data. -pub(crate) fn backup( - repo: &Repository, +pub(crate) fn backup( + repo: &Repository, opts: &BackupOptions, source: &PathList, snap: SnapshotFile, From c2ab370342ea2e407c97f65a88a026efd8e4dd6c Mon Sep 17 00:00:00 2001 From: Jiji Freya Daniel Maslowski Date: Tue, 29 Sep 2026 16:35:49 +0200 Subject: [PATCH 2/2] core/commands/backup: WIP: fix up documentation on archive()/backup_paths Signed-off-by: Jiji Freya Daniel Maslowski --- crates/core/src/commands/backup.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/core/src/commands/backup.rs b/crates/core/src/commands/backup.rs index 823d12a48..6dc1fcddf 100644 --- a/crates/core/src/commands/backup.rs +++ b/crates/core/src/commands/backup.rs @@ -205,10 +205,11 @@ pub struct BackupOptions { /// /// # Arguments /// -/// * `repo` - The repository to use -/// * `opts` - The backup options -/// * `src` - The source to backup -/// * `snap` - The snapshot with raw information +/// * `repo` - The repository to use +/// * `opts` - The backup options +/// * `src` - The source to backup +/// * `snap` - The snapshot with raw information +/// * `backup_paths` - Additional paths to back up? /// /// # Errors /// @@ -288,6 +289,7 @@ where archiver.archive( src, + // TODO: Why only the first one? What if `backup_paths` is empty? &backup_paths[0], as_path.as_ref(), opts.parent_opts.skip_if_unchanged, @@ -344,14 +346,14 @@ pub(crate) fn backup( archive(repo, &opts, &src, snap, &backup_paths)? } } else { - let backup_path = source.paths(); + let backup_paths = source.paths(); let src = LocalSource::new( opts.ignore_save_opts, &opts.excludes, &opts.ignore_filter_opts, - &backup_path, + &backup_paths, )?; - archive(repo, opts, &src, snap, &backup_path)? + archive(repo, opts, &src, snap, &backup_paths)? }; Ok(snap)