worktrunk
worktrunk copied to clipboard
[Bug] copy-ignore fails when an invalid symlink already exists in worktree in place of a matching file
When copy-ignoring, one of the files that would be copied already exists in the worktree as a symbolic link that points to a non existent path, the task fails with:
No such file or directory (os error 2)
✗ post-create command failed: copy-ignored: exit status: 1
Thanks for reporting this! I was able to identify the root cause: when the destination has a broken symlink, reflink_or_copy follows it and fails with ENOENT instead of recognizing the entry already exists. The fix checks symlink_metadata() (which doesn't follow symlinks) before attempting the copy, so broken symlinks at the destination are properly skipped.
I've opened #1549 with a fix. A maintainer will review it shortly.