You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
apply_patch move to same path deletes the file #45310
When apply_patch processes a Move directive where the destination path is the same as the source file path, it writes the new content then immediately removes the file — deleting what was just written. The file ends up missing instead of updated.
Steps to reproduce
Have a file same.txt with content old content
Apply a patch that updates the file and moves it to the same path:
*** Begin Patch
*** Update File: same.txt
*** Move to: same.txt
@@
-old content
+new content
*** End Patch
The file is deleted instead of containing new content
Root cause
In the case "move" branch, when movePath === filePath, the sequence is write(movePath, newContent) → remove(filePath), which removes the file just written. Since both paths resolve to the same absolute path, the remove undoes the write.
Activity