Repository navigation
Conversation
sylvestre
reviewed
Nov 23, 2026
| return Err(CpError::NotADirectory(dest.to_path_buf())); | ||
| } | ||
|
|
||
| let attributes_only = options.attributes_only || options.copy_mode == CopyMode::AttrOnly; |
Contributor
There was a problem hiding this comment.
CopyMode::AttrOnly already implies options.attributes_only, isn't the second check redundant?
Contributor
Author
There was a problem hiding this comment.
It’s redundant for CLI calls, but Rust callers can set CopyMode::AttrOnly while leaving attributes_only at its default of false. I kept the check and added a test for that case. I also added the --remove-destination --attributes-only regression test
|
|
||
| if source_metadata.is_symlink() { | ||
| copy_link(source, dest, symlinked_files, options)?; | ||
| } else if attributes_only { |
Contributor
There was a problem hiding this comment.
this also changes --remove-destination --attributes-only on a regular file (it now gives an empty dest instead of the data), could you please add a test for it?
limadog9
force-pushed
the
cp-attributes-update-16780
branch
2 times, most recently
from
November 23, 2026 13:07
a4f09ef to
ecb4e23
Compare
When a source is newer, apply the requested attributes without copying its data. Keep the existing destination contents, or create an empty file if the destination is missing or --remove-destination removed it. The CLI records --attributes-only separately from update mode. Library callers can also select CopyMode::AttrOnly with the default flag value. Test both entry points and the GNU 9.12 regular-file replacement case. Closes uutils#16780
limadog9
force-pushed
the
cp-attributes-update-16780
branch
from
December 1, 2026 17:25
ecb4e23 to
bbd4f06
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a source was newer,
cp -u --attributes-onlycopied its data into the destination. An empty template could erase a populated file.Honor
--attributes-onlyin the copy helper used after the update check. Existing regular files keep their contents, missing files are created empty, and requested attributes are applied in both cases.Closes #16780