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

Re: [PATCH] branch.c: simplify chain of if statements

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Mar 17, 2014, 12:53 UTC
Message-ID
<CACBZZX6P38BEQ15w1nVh9cM6nMj0dq-HtT1ZJFfZadriXjZReA@mail.gmail.com>
In-Reply-To
<loom.20140317T120153-546@post.gmane.org>
On Mon, Mar 17, 2014 at 12:46 PM, Dragos Foianu <dragos.foianu@gmail.com> wrote:
Show 5 quoted lines
> The reason I did not go with this is because I would still need the four ifs
> in order to keep the bug check part of the code. I might be able to find a
> work-around for it on the second attempt.
>
> I have seen N_() used in other code but I wasn't sure what its purpose was.

Aside from other comments here, more generally if you see code that looks odd it helps to see why it was introduced initially.

In this case if you'd ran e.g.:
    git log --reverse -p -G'Branch %s set up to track remote branch %s
from %s by rebasing' -- branch.c

or otherwise searched for the first occurrence of that odd-looking code you'd have gotten:

    commit d53a3503
    Author: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Date:   Thu Jun 7 19:05:10 2012 +0700
    Remove i18n legos in notifying new branch tracking setup
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

And searching for that commit has plenty of context for why that was done: https://www.google.com/search?q=%22Remove%20i18n%20legos%20in%20notifying%20new%20branch%20tracking%20setup%22

Previous: Dragos FoianuNext: Eric Sunshine
Message 6 of 7 in “branch.c: simplify chain of if statements”
  1. branch.c: simplify chain of if statementsDragos Foianu, Mar 16, 2014
  2. Matthieu MoyMar 17, 2014
  3. Eric SunshineMar 17, 2014
  4. Eric SunshineMar 17, 2014
  5. Dragos FoianuMar 17, 2014
  6. Ævar Arnfjörð BjarmasonMar 17, 2014
  7. Eric SunshineMar 18, 2014

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.