add -n for path expand, so it doesn't follow symlink (#6255)

* add -p for path expand, so it doesn't follow symlink

* fix arg name

* rename from no-dereferenct to no-follow-link

* rename from no-follow-link to no-symlink, and change short -p to -n

* follow strict first

* fix

* simplify test

* fix clippy

* fix test on windows
This commit is contained in:
WindSoilder
2022-08-10 21:43:56 +08:00
committed by GitHub
parent 2e5d981a09
commit 0f10d984c3
4 changed files with 90 additions and 20 deletions

View File

@@ -286,7 +286,7 @@ fn copy_dir_contains_symlink() {
// make symbolic link and copy.
nu!(
cwd: sandbox.cwd(),
"rm tmp_dir/good_bye; cp -r -p tmp_dir tmp_dir_2",
"rm tmp_dir/good_bye; cp -r -n tmp_dir tmp_dir_2",
);
// check hello_there exists inside `tmp_dir_2`, and `dangle_symlink` also exists inside `tmp_dir_2`.
@@ -309,7 +309,7 @@ fn copy_dir_symlink_file_body_not_changed() {
// make symbolic link and copy.
nu!(
cwd: sandbox.cwd(),
"rm tmp_dir/good_bye; cp -r -p tmp_dir tmp_dir_2; rm -r tmp_dir; cp -r -p tmp_dir_2 tmp_dir; echo hello_data | save tmp_dir/good_bye",
"rm tmp_dir/good_bye; cp -r -n tmp_dir tmp_dir_2; rm -r tmp_dir; cp -r -n tmp_dir_2 tmp_dir; echo hello_data | save tmp_dir/good_bye",
);
// check dangle_symlink in tmp_dir is no longer dangling.