git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 6 of 9 in “coccinelle: add and apply branch_get() rules”
  1. coccinelle: add and apply branch_get() rulesRubén Justo, Apr 6, 2023
  2. Junio C HamanoApr 7, 2023
  3. Junio C HamanoApr 7, 2023
  4. Rubén JustoApr 7, 2023
  5. Junio C HamanoApr 8, 2023
  6. Rubén JustoApr 9, 2023
  7. Ævar Arnfjörð BjarmasonApr 16, 2023
  8. Rubén JustoApr 16, 2023
  9. follow usage recommendations for branch_get()Rubén Justo, Apr 22, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.