rissem / syncer

MIT License
4 stars 1 forks source link

Catch sync to wrong repo #4

Open rissem opened 8 years ago

rissem commented 8 years ago

It's quite easy to run syncer from the wrong directory. This is harmless if the other directory is not a git repo, but if it is a repo it will overwrite the server's repo with the other directory. I think it should be possible to catch this "user error" and report it to them.

rdickert commented 8 years ago

For a simple first solution, should it just compare the git remote of both repos (e.g., github.com:rissem/syncer.git)? When this is defined, this is probably the best indication that the remote is safe to write to. This is no help if remote is not set, and there may be exceptions where this should be overridden, but checking this and requiring the user to override if they don't match would make things much safer. It might also be worth setting a git object or config file that explicitly allows syncer to know rather than trying to be smart using git.

Should it also warn if you are syncing to a copy of the repo that is one or more commits ahead?

rissem commented 8 years ago

Hmm, I think we'll want to support a solution where remote is undefined on the server. I'd like to support a flow where guthub credentials are not required on the server. Let's talk about possible solutions tomorrow. On Mar 15, 2016 12:57 PM, "Robert Dickert" notifications@github.com wrote:

For a simple first solution, should it just compare the git remote of both repos (e.g., github.com:rissem/syncer.git)? When this is defined, this is probably the best indication that the remote is safe to write to. This is no help if remote is not set, and there may be exceptions where this should be overridden, but checking this and requiring the user to override if they don't match would make things much safer. It might also be worth setting a git object or config file that explicitly allows syncer to know rather than trying to be smart using git.

Should it also warn if you are syncing to a copy of the repo that is one or more commits ahead?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/rissem/syncer/issues/4#issuecomment-196921567