mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
The bug was introduced in783963bwhile fixing IDEA-153272. Originally the code used to avoid registering unversioned and ignored moved files in performMoveRename(), thus they were not passed to `git add/rm` in executeMoveRename(), thus they were correctly not added to the VCS. But that behavior led to IDEA-153272 (both files are lost when unversioned file is moved to overwrite existing file of the same name) Here is what actually happened: 1. Delete original file to let it be overwritten. 2. beforeFileDeleted: remember to git rm this file later. 3. Move unversioned file to the place of original. 4. Don't remember the file because it is unversioned. 5. git rm the original file from executeDelete() after the command finished. => both unversioned (during the move) and original (during git rm) were deleted. The fix in783963bwas to avoid #4 in this sequence. However, moved unversioned files were not filtered anymore, and thus were later passed to executeMoveRename and further to `git add/rm/mv`. This fix is actually a partial revert of783963b: it returns filtering by UNKNOWN/INGORED file status back (with a special handle for Perforce), but in order to keep IDEA-153272 fixed it moves the unversioned & ignored check from performMoveRename to executeMoveRename. The latter is called after files are checked for doNotDeleteAddedCopiedOrMovedFiles => file is not scheduled for deletion anymore even if it was unversioned moved file. Tests were added for both IDEA-153272 and IDEA-118140.