File contents replaced from another file, repo on RPi out of sync now #143

Closed
wbphelps opened this Issue Feb 18, 2013 · 13 comments

Comments

Projects
None yet
2 participants

I was happily working on a file named "test1.py". It had nearly 300 lines of code in it. After running it sucessfully, I switched to "test1bb.py", a test case I wrote days ago to test something else. I made a couple of changes, did a save, and ran it. Then when I switched back to "test1.py", it now has the same contents as "test1bb.py" !!! As you can probably guess, I was pretty freaked out. A check on BitBucket shows that the file is still OK there, and that was a big relief.

I've restarted my browser (Chrome) and rebooted the RPi, and it still shows the wrong version of this file. How do I get it in sync with BitBucket again?

I tried copying the file from BitBucket and pasting it into a new file in WebIDE. Works, sort of, but the indents are a mess.

Is there anything you need to look at that might help figure out what the bug is?

William

Owner

jwcooper commented Feb 18, 2013

Sorry for the nasty bug! This is the first report of this type we've had; I'll see if I can reproduce it, thanks for the steps in your report.

You may just want to reset your local repository to your remote repository state. This will wipe out any local changes that aren't in bitbucket, so double check everything you want is out there. Open the terminal, and navigate to the root of your repository:

Assuming my-pi-projects repository:
cd /usr/share/adafruit/webide/repositories/my-pi-projects
git fetch origin
git reset --hard origin/master

I was able to fetch just the one file and get it back, thanks.

I tried to for a bit to reproduce this bug but was not able to. I'm wondering if it might be related to losing the connection to the RPi. The WebIDE doesn't seem to handle this very well, it just stops responding. If the network were busy for a period, and I clicked on a different file, and then the network freed up again, might the IDE save the wrong file?

This is getting a little more scary now. I've been working for hours now on one project. Making updates, saving, added a new file to the folder. Decided to go look at the repo on Bitbucket. No updates since yesterday. How does that happen? There were no errors. Save updated my RPi but apparently did not sync to bitbucket??? YIKES!

Owner

jwcooper commented Feb 19, 2013

I'm guessing your git repo is not in sync with the remote bitbucket repo now due to the earlier error. Open the terminal at the root of your repository, and type "git status". It may output errors. You can also manually type: "git push origin master" to see if that errors out as well. I'd backup your code at the very least, just to be sure before tinkering with the repository.

I've got a few ideas to prevent this from happening in the future, but it's tricky to cover all edge cases (like a network issue at a specific moment, if that was indeed the case here). We're hoping to have all this locked down by the time we roll out the beta!

There is indeed an error:

webide@wmpi /usr/share/adafruit/webide/repositories/my-pi-projects $ git status
error: object file .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1 is empty
fatal: loose object 26f26f8bc5e7326b2675ec17ad5ba36ea7484de1 (stored in .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1) is corrupt

I've just done a backup of the contents on the RPi to a usb flash drive and to my NAS. Should I delete and reinstall? I need to update to the latest version of WebIDE anyway. What do you suggest?

Owner

jwcooper commented Feb 19, 2013

You can just repair your repo (you'll lose any local changes, ensure your backup is good!):
cd /usr/share/adafruit/webide/repositories/my-pi-projects
git fetch origin
git reset --hard origin/master
git status

Update the WebIDE with the updater, if possible. What version of the WebIDE are you running?

WebIDE v0.3.2 - where do I find the updater? (sorry)

Owner

jwcooper commented Feb 19, 2013

Oh, that's the current latest version. I'd expect 0.3.3 to come out maybe later this week, or early next week. Once it goes live, you'll see a link in the upper right of the WebIDE to update.

Can't do git fetch origin -
webide@wmpi /usr/share/adafruit/webide/repositories/my-pi-projects $ git fetch origin
error: object file .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1 is empty
fatal: loose object 26f26f8bc5e7326b2675ec17ad5ba36ea7484de1 (stored in .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1) is corrupt

Owner

jwcooper commented Feb 19, 2013

In that case, you can just delete the my-pi-projects directory, and then refresh the WebIDE, and it will clone the my-pi-projects repository again.

On Tuesday, February 19, 2013 at 4:16 PM, William Phelps wrote:

Can't do git fetch origin -
webide@wmpi /usr/share/adafruit/webide/repositories/my-pi-projects $ git fetch origin
error: object file .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1 is empty
fatal: loose object 26f26f8 (26f26f8) (stored in .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1) is corrupt


Reply to this email directly or view it on GitHub (#143 (comment)).

OK, it's all back in sync now. Thank you for your excellent help and for this great tool. You've been busy!

Owner

jwcooper commented Feb 19, 2013

Great news, glad to help! :)

I'm going to leave this open as an issue I'll fix.

Owner

jwcooper commented Apr 6, 2013

I've added in much more error handling, so you should know right away if a file isn't getting pushed out to bitbucket. This will be part of 0.3.7.

jwcooper closed this Apr 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment