Fix symlink handling in CopyDirectory method#3914
Fix symlink handling in CopyDirectory method#3914black-desk wants to merge 1 commit intoactions:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the CopyDirectory method to properly detect and preserve symbolic links when copying directories and files.
- Adds early detection for directory symlinks and creates matching links in the target.
- Updates file-copy logic to skip already up-to-date files and supports file symlinks.
- Removes the duplicate
sourceDirdeclaration and centralizes its initialization.
Comments suppressed due to low confidence (1)
src/Runner.Sdk/Util/IOUtil.cs:392
- The new symlink-handling branches (for directories at lines 395–408 and files at lines 426–434) lack unit tests. Please add non-trivial L0 tests under
Test/L0to verify both directory and file symlink scenarios.
// Get the file contents of the directory to copy.
| } | ||
|
|
||
| // Check if source is a symlink | ||
| if (!sourceFile.Attributes.HasFlag(FileAttributes.ReparsePoint)) |
There was a problem hiding this comment.
[nitpick] For file symlinks, add a check to skip recreating an existing link when the target matches, similar to the directory case, to avoid unnecessary filesystem operations.
There was a problem hiding this comment.
I think this logic may have been covered by the section above that checks for the existence of target
|
I don't even have a full C# development environment, so if there's anything the project maintainers would like to change, it's perfectly fine to push it directly to my branch and merge it, and I hope this will be fixed soon. |
Fixes actions#3234 This change adds proper support for symbolic links in the CopyDirectory method. NOTE: This patch was developed with GitHub Copilot assistance. I has **NO** C# experience at all and is not familiar with actions/runner. This change has not been tested in a local environment. Please review this patch carefully. Signed-off-by: Chen Linxuan <me@black-desk.cn>
Fixes #3234
This change adds proper support for symbolic links
in the CopyDirectory method.
NOTE: This patch was developed with GitHub Copilot
assistance. I has NO C# experience at all and
is not familiar with actions/runner. This change
has not been tested in a local environment. Please
review this patch carefully.
Signed-off-by: Chen Linxuan me@black-desk.cn