8000 mv: rename canonized_* -> canonicalized_* by cakebaker · Pull Request #5454 · uutils/coreutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mv: rename canonized_* -> canonicalized_* #5454

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

Merged
merged 1 commit into from
Oct 27, 2023
Merged
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
10 changes: 5 additions & 5 deletions src/uu/mv/src/mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

// spell-checker:ignore (ToDO) sourcepath targetpath nushell
// spell-checker:ignore (ToDO) sourcepath targetpath nushell canonicalized

mod error;

Expand Down Expand Up @@ -405,7 +405,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->
return Err(MvError::NotADirectory(target_dir.quote().to_string()).into());
}

let canonized_target_dir = target_dir
let canonicalized_target_dir = target_dir
.canonicalize()
.unwrap_or_else(|_| target_dir.to_path_buf());

Expand Down Expand Up @@ -440,8 +440,8 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->

// Check if we have mv dir1 dir2 dir2
// And generate an error if this is the case
if let Ok(canonized_source) = sourcepath.canonicalize() {
if canonized_source == canonized_target_dir {
if let Ok(canonicalized_source) = sourcepath.canonicalize() {
if canonicalized_source == canonicalized_target_dir {
// User tried to move directory to itself, warning is shown
// and process of moving files is continued.
show!(USimpleError::new(
Expand All @@ -450,7 +450,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->
"cannot move '{}' to a subdirectory of itself, '{}/{}'",
sourcepath.display(),
target_dir.display(),
canonized_target_dir.components().last().map_or_else(
canonicalized_target_dir.components().last().map_or_else(
|| target_dir.display().to_string(),
|dir| { PathBuf::from(dir.as_os_str()).display().to_string() }
)
Expand Down
0