Web lists-archives.com

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




On 2017-04-17 20:02, Stefan Beller wrote:

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