Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Local files are overwritten when updating exercises #5114

Closed
tqa236 opened this issue Nov 11, 2019 · 10 comments
Closed

[Bug] Local files are overwritten when updating exercises #5114

tqa236 opened this issue Nov 11, 2019 · 10 comments

Comments

@tqa236
Copy link

tqa236 commented Nov 11, 2019

As the title indicates, all of my local files (including the solution files) are totally overwritten when I update an exercise. I already tested this on Windows 10 and Ubuntu and received the same behavior.

I think the reason is that now the updating and downloading commands are merged into one. I remember that they are separated before.

Before clicking updating:
Screenshot from 2019-11-11 10-25-56

After clicking updating:

Screenshot from 2019-11-11 10-26-06

Can anyone reproduce this bug? Thank you very much.

@NobbZ
Copy link
Member

NobbZ commented Nov 11, 2019

This doesn't show any file beein overwritten.

The download command will always make sure, that all files which it is aware of, have the same state locally and remote.

So if you made changes locally, that you did not submit, those will be lost when using the download command. This is independant from using the "update" functionality on the website.

@tqa236
Copy link
Author

tqa236 commented Nov 11, 2019

My point is: There's no longer an "update" functionality on the website (or not that I'm aware of).

Before, there's another button that appeared when I clicked "Update exercise to latest version". It's no longer the case now.

@NobbZ
Copy link
Member

NobbZ commented Nov 11, 2019

After you clicked "update", your server side version of the tests get bumped to whatever is current on git then. You can use exercism download to get those updated set of files.

The "update" button only appears if there are updates available to you.

I'm not sure what you expect otherwise.

@tqa236
Copy link
Author

tqa236 commented Nov 11, 2019

And when I "exercism download" those files, if my local solution file is different from the server side, it will be overwritten by the server solution, is that correct?

As far as I understand, if I submit a solution named "foo.py", this file shouldn't be downloaded when I update the exercise (I only want to update README and the test suite), which doesn't seem to be the case here.

@NobbZ
Copy link
Member

NobbZ commented Nov 11, 2019

As I said, if your local version of the file of the server side version, then download will "repair" it to match what was submitted earlier.

This is as expected.

@NobbZ
Copy link
Member

NobbZ commented Nov 11, 2019

It is not though replaced by stubs or similar that were available upstream.

@sshine
Copy link

sshine commented Nov 11, 2019

when I "exercism download" those files, if my local solution file is different from the server side, it will be overwritten by the server solution, is that correct?

I have experienced this behavior myself with great dismay: I used a local copy to keep different variations of a solution for an exercise, but hadn't uploaded a new iteration, since I had begun to use the local copy as mentoring notes.

Unfortunately updating the exercise wiped the copies, which I eventually have recreated over time. Since I didn't put my exercism directory into git control, I now have to remember that if I ever want to update an exercise, I should make sure to manually back up my local copy.

A safer behavior of the exercism CLI would be to check if the to-be-downloaded files have differences, and if they do, notify the user and move the local version to another location like file.tmp, and if that file already exists, file.tmp.1, and so on.

@tqa236
Copy link
Author

tqa236 commented Nov 11, 2019

@NobbZ Thank you. That's clear to me. I thought it was different. My memory should have failed me on this.

So, to sum up, if we've already solved an exercise, "download" won't give us the default stub but will give us the last file we submitted, even if it is different from the local file.

I have no more questions, please feel free to close the issue if you think it's fine.

@sshine
Copy link

sshine commented Nov 11, 2019

As I highlighted, I think overwriting a file without question is possibly not the best choice.

@ErikSchierboom
Copy link
Member

Hello 👋

With the launch of Exercism v3, we are closing all issues in this repository to help give us a clean slate to detect new problems. If this issue is still relevant to Exercism v3 (e.g. it's a feature that we haven't implemented in v3, or a bug that still exists), please reopen it and we will review it and post an update on it as soon as we get chance.

Thanks for helping make Exercism better, and we hope you enjoy v3 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants