Skip to content

Commit

Permalink
Applied Linters
Browse files Browse the repository at this point in the history
  • Loading branch information
rpschoenburg committed Jan 8, 2025
1 parent 9b08289 commit abefbfd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/lib/src/core/v0_19_0/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,17 @@ pub fn process_add_dir(
let added_file_counter_clone = Arc::clone(&added_file_counter);
let unchanged_file_counter_clone = Arc::clone(&unchanged_file_counter);

let relative_dir_path = util::fs::path_relative_to_dir(dir, repo_path).unwrap();
let relative_dir_path = util::fs::path_relative_to_dir(dir, repo_path).unwrap();

// Fix for Windows CLI
// TODO: does dir_path ever not exist? this will propogate an error if so
let dir_path = if relative_dir_path.exists() {
relative_dir_path
} else {
log::debug!("dir path {relative_dir_path:?} was not found. Checking for Windows CLI");
util::fs::path_relative_to_canon_dir(dir, &repo.path.clone())?

log::debug!(
"dir path {relative_dir_path:?} was not found. Checking for Windows CLI"
);
util::fs::path_relative_to_canon_dir(dir, repo.path.clone())?
};
log::debug!("path now: {dir_path:?}");

Expand Down
1 change: 1 addition & 0 deletions src/lib/src/repositories/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ mod tests {
path: PathBuf::from("images/*"),
recursive: false,
staged: false,
is_cli: false,
};

repositories::rm(&repo, &rm_opts)?;
Expand Down
13 changes: 13 additions & 0 deletions src/lib/src/repositories/rm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ mod tests {
path: rm_dir.to_owned(),
recursive: true,
staged: false,
is_cli: false,
};
println!("Before rm");
repositories::rm(&repo, &opts)?;
Expand Down Expand Up @@ -545,6 +546,7 @@ mod tests {
path: PathBuf::from("images/*"),
recursive: false,
staged: false,
is_cli: false,
};

repositories::rm(&repo, &rm_opts)?;
Expand All @@ -562,6 +564,7 @@ mod tests {
path: PathBuf::from("images/*"),
recursive: false,
staged: true,
is_cli: false,
};

repositories::rm(&repo, &rm_opts)?;
Expand Down Expand Up @@ -618,6 +621,7 @@ mod tests {
path: path.to_path_buf(),
staged: true,
recursive: false, // This should be an error
is_cli: false,
};
let result = repositories::rm(&repo, &opts);
assert!(result.is_err());
Expand All @@ -643,6 +647,7 @@ mod tests {
path: path.to_path_buf(),
staged: true,
recursive: true, // make sure to pass in recursive
is_cli: false,
};
repositories::rm(&repo, &opts)?;

Expand Down Expand Up @@ -673,6 +678,7 @@ mod tests {
path: path.to_path_buf(),
staged: true,
recursive: true, // make sure to pass in recursive
is_cli: false,
};
repositories::rm(&repo, &opts)?;

Expand Down Expand Up @@ -702,6 +708,7 @@ mod tests {
path: path.to_path_buf(),
staged: true,
recursive: true, // make sure to pass in recursive
is_cli: false,
};
let result = repositories::rm(&repo, &opts);
assert!(result.is_ok());
Expand Down Expand Up @@ -750,6 +757,7 @@ mod tests {
path: path.to_path_buf(),
staged: false,
recursive: false, // This should be an error
is_cli: false,
};

let result = repositories::rm(&repo, &opts);
Expand All @@ -770,6 +778,7 @@ mod tests {
path: train_dir.to_path_buf(),
staged: false,
recursive: true, // Need to specify recursive
is_cli: false,
};

let result = repositories::rm(&repo, &opts);
Expand All @@ -795,6 +804,7 @@ mod tests {
path: train_dir.to_path_buf(),
staged: false,
recursive: true, // Need to specify recursive
is_cli: false,
};

// copy a cat into the dog image
Expand Down Expand Up @@ -836,6 +846,7 @@ mod tests {
path: path.to_path_buf(),
staged: false,
recursive: true, // Must pass in recursive = true
is_cli: false,
};
repositories::rm(&repo, &opts)?;

Expand Down Expand Up @@ -875,6 +886,7 @@ mod tests {
path: path.to_path_buf(),
staged: false,
recursive: true, // Must pass in recursive = true
is_cli: false,
};
repositories::rm(&repo, &opts)?;

Expand Down Expand Up @@ -902,6 +914,7 @@ mod tests {
path,
staged: false,
recursive: true, // Must pass in recursive = true
is_cli: false,
};
repositories::rm(&repo, &opts)?;

Expand Down

0 comments on commit abefbfd

Please sign in to comment.