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

Re: [PATCH] submodule: remove a superfluous second check for the "new" variable

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Apr 17, 2017, 18:21 UTC
Message-ID
<be511659-83fb-9b34-0ce8-8f6c21b91143@gmail.com>
In-Reply-To
<CAGZ79kb01g0AoD0b+ysqd-H049BAX-j0om2pwPqXA7fXhX2Y8w@mail.gmail.com>
On 2017-04-17 20:02, Stefan Beller wrote:
Show 15 quoted lines
>> diff --git a/submodule.c b/submodule.c
>> index c52d663..68623bd 100644
>> --- a/submodule.c
>> +++ b/submodule.c
>> @@ -1396,8 +1396,7 @@ int submodule_move_head(const char *path,
>>                          cp1.no_stdin = 1;
>>                          cp1.dir = path;
>>
>> -                       argv_array_pushl(&cp1.args, "update-ref", "HEAD",
>> -                                        new ? new : EMPTY_TREE_SHA1_HEX, NULL);
>> +                       argv_array_pushl(&cp1.args, "update-ref", "HEAD", new, NULL);
> 
> EMPTY_TREE_SHA1_HEX != NULL?
> 
> Can you clarify the intent in the commit message?
Sure. A few lines up (3 lines out of the diff) we have "if (new) {" [1], thus there's no need to check "new != NULL" here again.
[1] https://github.com/git/git/pull/345/files#diff-471db3ea6697763218bb8335a95ece57R1392
-- 
Sebastian Schuberth
Previous: Stefan Beller
Message 3 of 3 in “submodule: remove a superfluous second check for the "new" variable”
  1. submodule: remove a superfluous second check for the "new" variableSebastian Schuberth, Apr 17, 2017
  2. Stefan BellerApr 17, 2017
  3. Sebastian SchuberthApr 17, 2017

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.