octokit.rb icon indicating copy to clipboard operation
octokit.rb copied to clipboard

Change the default value of `update_ref` `force` to false

Open pocke opened this issue 7 years ago • 3 comments

Problem

Currently, Octokit::Client#update_ref updates a reference with force: true option. It works like git push --force. I think the behaviour is a problem for two reasons.

Firstly, the behaviour is dangerous. Force push destroys pushed commits sometimes. I think dangerous operations should be optional.

Secondly, the default value is false in the GitHub API.

Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to false will make sure you're not overwriting work. Default: false

https://developer.github.com/v3/git/refs/#update-a-reference

I think Octokit default value should be same as the GitHub API.

Note

It is a breaking change. If someone uses update_ref method without a default value and expects "force push", it will be broken. But I think we should change default behaviour. What do you think?

pocke avatar Jan 22 '18 05:01 pocke

Thanks for the PR @pocke!

I like this change, but like you said it's a breaking change to the client. So we're going to wait to 🚢 this when we start the process of releasing Octokit 5.0.

Let me know if you have any questions.

tarebyte avatar Feb 01 '18 18:02 tarebyte

I like this change, but like you said it's a breaking change to the client. So we're going to wait to 🚢 this when we start the process of releasing Octokit 5.0.

It seems good. Thank you!

pocke avatar Feb 02 '18 06:02 pocke