{"thread":{"id":"45717","subject":"[PATCH] submodule: remove a superfluous second check for the \"new\" variable","startedAt":"2017-04-17T07:59:58Z","lastAt":"2017-04-17T18:21:33Z","messageCount":3,"participants":["Sebastian Schuberth","Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"316995","messageId":"0102015b7aecbf67-2f63e58b-5f75-4c9b-975f-e8e35176d510-000000@eu-west-1.amazonses.com","threadId":"45717","inReplyTo":null,"subject":"[PATCH] submodule: remove a superfluous second check for the \"new\" variable","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2017-04-17T07:59:47Z","receivedAt":"2017-04-17T07:59:58Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>\n---\n submodule.c | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/submodule.c b/submodule.c\nindex c52d663..68623bd 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1396,8 +1396,7 @@ int submodule_move_head(const char *path,\n \t\t\tcp1.no_stdin = 1;\n \t\t\tcp1.dir = path;\n \n-\t\t\targv_array_pushl(&cp1.args, \"update-ref\", \"HEAD\",\n-\t\t\t\t\t new ? new : EMPTY_TREE_SHA1_HEX, NULL);\n+\t\t\targv_array_pushl(&cp1.args, \"update-ref\", \"HEAD\", new, NULL);\n \n \t\t\tif (run_command(&cp1)) {\n \t\t\t\tret = -1;\n\n--\nhttps://github.com/git/git/pull/345\n"},{"id":"317018","messageId":"CAGZ79kb01g0AoD0b+ysqd-H049BAX-j0om2pwPqXA7fXhX2Y8w@mail.gmail.com","threadId":"45717","inReplyTo":"0102015b7aecbf67-2f63e58b-5f75-4c9b-975f-e8e35176d510-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH] submodule: remove a superfluous second check for the \"new\" variable","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-04-17T18:02:02Z","receivedAt":"2017-04-17T18:02:10Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Apr 17, 2017 at 12:59 AM, Sebastian Schuberth\n<sschuberth@gmail.com> wrote:\n> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>\n> ---\n>  submodule.c | 3 +--\n>  1 file changed, 1 insertion(+), 2 deletions(-)\n>\n> diff --git a/submodule.c b/submodule.c\n> index c52d663..68623bd 100644\n> --- a/submodule.c\n> +++ b/submodule.c\n> @@ -1396,8 +1396,7 @@ int submodule_move_head(const char *path,\n>                         cp1.no_stdin = 1;\n>                         cp1.dir = path;\n>\n> -                       argv_array_pushl(&cp1.args, \"update-ref\", \"HEAD\",\n> -                                        new ? new : EMPTY_TREE_SHA1_HEX, NULL);\n> +                       argv_array_pushl(&cp1.args, \"update-ref\", \"HEAD\", new, NULL);\n\nEMPTY_TREE_SHA1_HEX != NULL?\n\nCan you clarify the intent in the commit message?\n\nThanks,\nStefan\n"},{"id":"317019","messageId":"be511659-83fb-9b34-0ce8-8f6c21b91143@gmail.com","threadId":"45717","inReplyTo":"CAGZ79kb01g0AoD0b+ysqd-H049BAX-j0om2pwPqXA7fXhX2Y8w@mail.gmail.com","subject":"Re: [PATCH] submodule: remove a superfluous second check for the \"new\" variable","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2017-04-17T18:21:23Z","receivedAt":"2017-04-17T18:21:33Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On 2017-04-17 20:02, Stefan Beller wrote:\n\n>> diff --git a/submodule.c b/submodule.c\n>> index c52d663..68623bd 100644\n>> --- a/submodule.c\n>> +++ b/submodule.c\n>> @@ -1396,8 +1396,7 @@ int submodule_move_head(const char *path,\n>>                          cp1.no_stdin = 1;\n>>                          cp1.dir = path;\n>>\n>> -                       argv_array_pushl(&cp1.args, \"update-ref\", \"HEAD\",\n>> -                                        new ? new : EMPTY_TREE_SHA1_HEX, NULL);\n>> +                       argv_array_pushl(&cp1.args, \"update-ref\", \"HEAD\", new, NULL);\n> \n> EMPTY_TREE_SHA1_HEX != NULL?\n> \n> Can you clarify the intent in the commit message?\n\nSure. 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.\n\n[1] https://github.com/git/git/pull/345/files#diff-471db3ea6697763218bb8335a95ece57R1392\n\n-- \nSebastian Schuberth\n"}]}