WebIDE: Incorrect diff of deletion and addition of the same file

Summary

In Web IDE, if you delete a file, and then add a new file by the same name, and stage everything, the diff shown is incorrect. It shows that you added a new file, but the deletion of old file is nowhere to be found in the diff.

Case 1. New file added with content different from the old file

Steps

  1. Delete an existing file, lets say README.md.
  2. Add a new file with the same name: README.md.
  3. Add some content to that file, say hello world.
  4. Stage all changes.
Current Behaviour Expected Behaviour
Result Staged diff of README.md shows:
Removed: (empty)
Added: hello world
Staged diff of README.md shows:
Removed: (content of deleted README.md)
Added: hello world
Screenshot Screenshot_2019-12-06_at_1.16.05_PM Screenshot_2019-12-06_at_1.06.35_PM

Case 2. New file added with the same content as the old file

Steps

  1. Copy the contents of a file, say README.md.
  2. Delete the file.
  3. Add a new file with the same name: README.md.
  4. Paste the contents you copied earlier in Step 1.
  5. Stage all changes.
Current Behaviour Expected Behaviour
Result Staged diff of README.md shows:
Removed: (empty)
Added: (content of README.md that you pasted)
There is no staged diff of README.md, so the commit tab is not visible at all.
Screenshot Screenshot_2019-12-06_at_1.17.55_PM Screenshot_2019-12-06_at_1.19.40_PM

In contrast with the above differences, the following case works just fine:

Case 3. Rename a file to another name, and then rename it back to its original name.

Steps

  1. Rename a file, say README.md to README2.md.
  2. Stage all changes.
  3. Rename the file back to its original name (README2.md to README.md).

Result

There is no staged diff of README.md, so the commit tab is not visible at all.

Edited Dec 13, 2019 by Himanshu Kapoor
Assignee Loading
Time tracking Loading