Should I send a patch?

Once in a while I find issues on github, mails on mailinglists or even questions in IRC/Matrix/whateverelse that always end with the same phrase:

Should I send a patch for this?

One recent example is this very well drafted mail on the sr.ht-discuss mailinglist (*).

The answer to this question is (almost) always: YES PLEASE! Even moreso, the answer to this question is a question itself: “Why didn't you in the first place?”.

Sending a patch vs asking

Most of the time (and with the mail linked above) the overhead between asking whether a patch would be appropriate and just sending the patch is minimal. The effort crafting the patch is something in the lower minute range, nothing that takes a few hours. Plus, the rationale why the patch was created serves perfectly as a commit message!

Consider this: The patch is trivial, the rationale is rather long. Having the rationale as commit message and sending the patch with the rationale as commit message results in several benefits for everyone:

If the patch is declined, very minimal effort was wasted. The ratio between effort saved if the patch is applied and effort wasted if it is not applied is actually very low. Plus, most projects would love to have more contributions, so getting a “No” right away is not that common!

Of course, there's also cases where you'd want to ask before actually working on a patch. That's the case if there needs to be serious effort be involved. If you'd need to refactor a large portion of the codebase, for example, you might want to get in touch with the maintainers first, whether such a change would be accepted.

I'd argue, though, that most of the time you can just fire away with your patches. That's certainly the way I handle it and most of the time they are applied right away without any back-and-forth!


(*): This mail just serves as an example here because it sparked my inspiration for writing this article. I do not want to attack the author in any way, neither do I either agree or disagree with the changes proposed in the mail.