Skip to content

Commit 9f432cb

Browse files
CopilotKSXGitHub
andcommitted
Return RuntimeError when --deduplicate-hardlinks used with multiple args
Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
1 parent 79db139 commit 9f432cb

6 files changed

Lines changed: 31 additions & 999 deletions

File tree

src/app.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl App {
3838
}
3939

4040
/// Run the application.
41-
pub fn run(mut self) -> Result<(), RuntimeError> {
41+
pub fn run(self) -> Result<(), RuntimeError> {
4242
// DYNAMIC DISPATCH POLICY:
4343
//
4444
// Errors rarely occur, therefore, using dynamic dispatch to report errors have an acceptable
@@ -156,11 +156,7 @@ impl App {
156156
}
157157

158158
if cfg!(unix) && self.args.deduplicate_hardlinks && self.args.files.len() > 1 {
159-
// Hardlinks deduplication doesn't work properly if there are more than 1 paths pointing to
160-
// the same tree or if a path points to a subtree of another path. Therefore, we must find
161-
// and remove such overlapping paths before they cause problems.
162-
use overlapping_arguments::{remove_overlapping_paths, RealApi};
163-
remove_overlapping_paths::<RealApi>(&mut self.args.files);
159+
return Err(RuntimeError::DeduplicateHardlinkMultipleArgs);
164160
}
165161

166162
let report_error = if self.args.silent_errors {
@@ -331,4 +327,3 @@ impl App {
331327

332328
mod hdd;
333329
mod mount_point;
334-
mod overlapping_arguments;

src/app/overlapping_arguments.rs

Lines changed: 0 additions & 126 deletions
This file was deleted.

src/app/overlapping_arguments/test_remove_items_from_vec_by_indices.rs

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)