worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

[Bug] copy-ignore fails when an invalid symlink already exists in worktree in place of a matching file

Open armstrjare opened this issue 8 months ago • 1 comments

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

armstrjare avatar Mar 15 '26 23:03 armstrjare

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.

worktrunk-bot avatar Mar 16 '26 00:03 worktrunk-bot