git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] submodule: remove a superfluous second check for the "new" variable
@ 2017-04-17  7:59 Sebastian Schuberth
  2017-04-17 18:02 ` Stefan Beller
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Schuberth @ 2017-04-17  7:59 UTC (permalink / raw)
  To: git

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 submodule.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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);
 
 			if (run_command(&cp1)) {
 				ret = -1;

--
https://github.com/git/git/pull/345

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] submodule: remove a superfluous second check for the "new" variable
  2017-04-17  7:59 [PATCH] submodule: remove a superfluous second check for the "new" variable Sebastian Schuberth
@ 2017-04-17 18:02 ` Stefan Beller
  2017-04-17 18:21   ` Sebastian Schuberth
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Beller @ 2017-04-17 18:02 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: git@vger.kernel.org

On Mon, Apr 17, 2017 at 12:59 AM, Sebastian Schuberth
<sschuberth@gmail.com> wrote:
> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
> ---
>  submodule.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> 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?

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] submodule: remove a superfluous second check for the "new" variable
  2017-04-17 18:02 ` Stefan Beller
@ 2017-04-17 18:21   ` Sebastian Schuberth
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Schuberth @ 2017-04-17 18:21 UTC (permalink / raw)
  To: Stefan Beller; +Cc: git@vger.kernel.org

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-17 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-17  7:59 [PATCH] submodule: remove a superfluous second check for the "new" variable Sebastian Schuberth
2017-04-17 18:02 ` Stefan Beller
2017-04-17 18:21   ` Sebastian Schuberth

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).