ls1intum / Artemis

Artemis - Interactive Learning with Automated Feedback
https://docs.artemis.cit.tum.de
MIT License
481 stars 288 forks source link

`Programming exercises`: Code editor refresh files does not delete local files #7571

Open florian-glombik opened 10 months ago

florian-glombik commented 10 months ago

Describe the bug

Refresh files does not delete files that are not on the server (but clears their content)

To Reproduce

  1. Create an exam with a programming exercise, activate the online code editor
  2. add a new file
  3. enter text in the file
  4. do not submit
  5. use Refresh files
  6. See that the content of the file is reset, but the file is not deleted

Expected behavior

Newly created files that are not pushed to remote should be deleted when pressing Refresh files

Which version of Artemis are you seeing the problem on?

6.6.4

What browsers are you seeing the problem on?

Chrome

pzdr7 commented 7 months ago

Adding a new file in the code editor adds it as an (empty) unstaged file to the repository. If you then refresh the files in the code editor, Artemis fetches the current state of the repository (which includes the unstaged file) and, upon opening it, loads its empty content from the repository.

If we executed a git clean when refreshing the files, these unstaged files would be removed. However, this would likely cause issues whenever multiple instances of the code editor are open simultaneously. (This is not restricted to exams, but programming exercises in general.)