ef-labs / stash-hook-mirror

An Atlassian Stash repository hook for mirroring to one or more remote git repositories.
MIT License
77 stars 58 forks source link

Force push #21

Closed xaviershay closed 10 years ago

xaviershay commented 10 years ago

Can't think of any reason not to do this, and I was seeing some repositories fail to push.

adrianluisgonzalez commented 10 years ago

Some remote repositories actively block git push --force. Looks like you have commented on it here: https://answers.atlassian.com/questions/256607/how-to-disable-reject-force-push-plugin

I think this would require a checkbox in the UI to enable the force argument (off by default). What do you think?

xaviershay commented 10 years ago

I can't imagine why you would have that enabled on a mirrored repository though? In my mind, "mirror this repository" means the remote should be an exact copy of the current one. The only way to guarantee that is with force pushes.

adrianluisgonzalez commented 10 years ago

Fair point.

adrianluisgonzalez commented 10 years ago

v1.9.0 is available on the marketplace.

landonf commented 10 years ago

Late to the party, but I'm uncomfortable with --force being the default here, and the ramifications for failure.

Preventing local writes to the mirror target is ultimately the responsibility of whoever controls access to the remote repository, and we do have --force disabled on all repositories by default, as there's never a case where we want a forced push to be accepted.

adrianluisgonzalez commented 10 years ago

@landonf, any interest in contributing a UI checkbox to enable/disable the --force argument?

landonf commented 10 years ago

Since @xaviershay had the need for a very large hammer, I agree with your original request to include a UI to enable it.

However, the horse has left the barn; unless you're comfortable rolling this change back, I'll take a look at putting together a patch.

adrianluisgonzalez commented 10 years ago

The horse is roaming free, will need to release a new version to the Atlassian marketplace.

xaviershay commented 10 years ago

Preventing local writes to the mirror target is ultimately the responsibility of whoever controls access to the remote repository

In my experience with thousands of repos, some of them always get in a weird state. But if it works for you, seems like option to disable (or enable, w/e) makes sense.

there's never a case where we want a forced push to be accepted.

this is surprising to me. I can't imagine a development workflow that didn't allow force pushes. (or more technically: I can't imagine convincing an entire engineering team that they shouldn't use force pushes.)

landonf commented 10 years ago

In my experience with thousands of repos, some of them always get in a weird state. But if it works for you, seems like option to disable (or enable, w/e) makes sense.

Is that volunteering? :-)

I can't imagine a development workflow that didn't allow force pushes. (or more technically: I can't imagine convincing an entire engineering team that they shouldn't use force pushes.)

It depends on your engineering team and their notions of best practices, I imagine.

xaviershay commented 10 years ago

I got no idea how do a UI :/

xaviershay commented 10 years ago

and fwiw if you reverted this I'd just keep running my fork so nbd.