public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Rubén Justo" <rjusto@gmail•com>
To: Junio C Hamano <gitster@pobox•com>
Cc: Git List <git@vger•kernel.org>
Subject: Re: [PATCH] coccinelle: add and apply branch_get() rules
Date: Sun, 9 Apr 2023 09:43:06 +0200	[thread overview]
Message-ID: <d01d9fc8-0112-eae3-0792-1e75912720e2@gmail.com> (raw)
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.

> >> 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...

  reply	other threads:[~2023-04-09  7:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 20:34 [PATCH] coccinelle: add and apply branch_get() rules Rubén Justo
2023-04-07 15:55 ` Junio C Hamano
2023-04-07 16:05   ` Junio C Hamano
2023-04-07 19:09   ` Rubén Justo
2023-04-08 22:45     ` Junio C Hamano
2023-04-09  7:43       ` Rubén Justo [this message]
2023-04-16 13:56 ` Ævar Arnfjörð Bjarmason
2023-04-16 23:26   ` Rubén Justo
2023-04-22 22:27 ` [PATCH v2] follow usage recommendations for branch_get() Rubén Justo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d01d9fc8-0112-eae3-0792-1e75912720e2@gmail.com \
    --to=rjusto@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox