Re: [PATCH] coccinelle: add and apply branch_get() rules
- From
Rubén Justo <rjusto@gmail.com>
- Date
- Apr 9, 2023, 07:43 UTC
- Message-ID
- <d01d9fc8-0112-eae3-0792-1e75912720e2@gmail.com>
- In-Reply-To
- <xmqqjzymf0wt.fsf@gitster.g>
On 08-abr-2023 15:45:54, Junio C Hamano wrote:
> I do not know why you are > arguing against my suggestion to improve your proposed log message.
Sorry, that's not my intention. The recommendation still stands and the message was not clear about it.
Show 10 quoted lines
> >> Stepping back a bit. What is the ultimate goal for this change? > > > > Of course, as you pointed out, there are usages where a computed value > > is used, perhaps coming from the user, which might end up specifying > > "HEAD". Those usages of branch_get() are not considered here. Not even > > indirect ones. > > That is what I found problematic, because I do not think this > particular change will get us closer to the endgame of not feedling > "" or "HEAD", if ...
The objective in this patch is to avoid having in the codebase branch_get("HEAD") in favor of branch_get(NULL). Because that's what we recommend and, anyway, a smart compiler is going to optimize out that strcmp with two literals. Therefore, we follow the recommendations and save some compiler effort in the way.
But, branch_get() cannot stop supporting a computed value that ends being "HEAD", as a way to refer to the current branch. However, maybe you are suggesting so...