Web IDE: "Discard all changes" fails on newly added and renamed files

Summary

In Web IDE, when clicking "Discard all changes" on a set of changes containing newly-added file, a JS error is thrown in the console and discarding doesn't happen.

Steps to reproduce

  • Go to a Project in WebIDE
  • Upload a file (an image, for example)
  • Click "Commit"
  • In the "Unstaged changes" field, you will see your newly added file
  • Click "Discard all changes" and confirm it in the popped up overlay
  • Check your console in DevTools: it will contain TypeError information

What is the current bug behavior?

  1. When discarding a change set with newly-added file, discarding doesn't happen
  2. JS error is thrown in the console

What is the expected correct behavior?

Discarding change sets with newly-added files should revert all changes and remove newly-added files from the project's change set. No JS error should be thrown.

Relevant logs and/or screenshots

Screenshot_2019-06-05_at_10.29.52

Output of checks

This bug happens on GitLab.com

Edited by Denys Mishunov