Re: [RFC PATCH 1/9] rebase -i: only write fixup-message when it's needed
From: Junio C Hamano <hidden>
Date: 2021-01-15 17:23:39
Charvi Mendiratta [off-list ref] writes:
Okay, I looked into the write_message(...) and agree that it does not return a positive value and only returns non-zero for error case and zero for success. So, for this patch maybe we can ignore checking '< 0' here and later add another patch to make this function follow the convention of "negative is error".
Please don't. There is a higher cognitive cost to readers when you write
if (write_message(...)) {
The reader is forced to look at its implementation to see if it
returns positive in a non-error situation.
If you write it like so from the beginning
if (write_message(...) < 0) {
the reader can trust that the code follows "negative is an error"
convention. One fewer thing readers have to worry about.