git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remove unnecessary 'if'
@ 2008-12-10 14:09 Alexander Potashev
  2008-12-14 16:21 ` Alexander Potashev
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Potashev @ 2008-12-10 14:09 UTC (permalink / raw)
  To: git; +Cc: gitster, Alexander Potashev

'patch->is_new' is always <= 0 at this point (look at 'assert' at the
beginning of the function). In both cases ('is_new < 0' and 'is_new == 0')
the result of those two lines is zeroing of 'is_new'.

Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
---
 builtin-apply.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 4c4d1e1..904a748 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2440,8 +2440,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
 	if (!cached)
 		st_mode = ce_mode_from_stat(*ce, st->st_mode);
 
-	if (patch->is_new < 0)
-		patch->is_new = 0;
+	patch->is_new = 0;
 	if (!patch->old_mode)
 		patch->old_mode = st_mode;
 	if ((st_mode ^ patch->old_mode) & S_IFMT)
-- 
1.6.0.4

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

* Re: [PATCH] remove unnecessary 'if'
  2008-12-10 14:09 [PATCH] remove unnecessary 'if' Alexander Potashev
@ 2008-12-14 16:21 ` Alexander Potashev
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Potashev @ 2008-12-14 16:21 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Hello all!

What happened with this patch? Is it wrong or breaks comprehensibility?

On 17:09 Wed 10 Dec     , Alexander Potashev wrote:
> 'patch->is_new' is always <= 0 at this point (look at 'assert' at the
> beginning of the function). In both cases ('is_new < 0' and 'is_new == 0')
> the result of those two lines is zeroing of 'is_new'.
> 
> Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
> ---
>  builtin-apply.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/builtin-apply.c b/builtin-apply.c
> index 4c4d1e1..904a748 100644
> --- a/builtin-apply.c
> +++ b/builtin-apply.c
> @@ -2440,8 +2440,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
>  	if (!cached)
>  		st_mode = ce_mode_from_stat(*ce, st->st_mode);
>  
> -	if (patch->is_new < 0)
> -		patch->is_new = 0;
> +	patch->is_new = 0;
>  	if (!patch->old_mode)
>  		patch->old_mode = st_mode;
>  	if ((st_mode ^ patch->old_mode) & S_IFMT)
> -- 
> 1.6.0.4
> 

					Alexander

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

end of thread, other threads:[~2008-12-14 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 14:09 [PATCH] remove unnecessary 'if' Alexander Potashev
2008-12-14 16:21 ` Alexander Potashev

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 NNTP newsgroup(s).