-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
cp: allow directory merging when destination was just created #9325
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
Conversation
Previously, when copying to a destination that was created in the same cp call, the operation would fail with "will not overwrite just-created" for both files and directories. This change allows directories to be merged (matching GNU cp behavior) while still preventing file overwrites. The fix checks if both the source and destination are directories before allowing the merge. If either is a file, the original error behavior is preserved to prevent accidental file overwrites. Fixes the case where copying multiple directories to the same destination path would incorrectly error instead of merging their contents. fixes: uutils#9318
1092b9b to
efcdbfe
Compare
CodSpeed Performance ReportMerging #9325 will not alter performanceComparing Summary
Footnotes
|
|
GNU testsuite comparison: |
cakebaker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other changes look fine :)
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
|
@cakebaker Applied the suggestions, thanks! |
|
GNU testsuite comparison: |
|
Thanks! |
Previously, when copying to a destination that was created in the same cp call, the operation would fail with "will not overwrite just-created" for both files and directories. This change allows directories to be merged (matching GNU cp behavior) while still preventing file overwrites.
The fix checks if both the source and destination are directories before allowing the merge. If either is a file, the original error behavior is preserved to prevent accidental file overwrites.
Fixes the case where copying multiple directories to the same destination path would incorrectly error instead of merging their contents.
fixes: #9318