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

[PATCH] remove unnecessary 'if'

From
APAlexander Potashev <aspotashev@gmail.com>
Date
Dec 10, 2008, 14:09 UTC
Message-ID
<1228918156-3953-1-git-send-email-aspotashev@gmail.com>

'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
Next: Alexander Potashev
Message 1 of 2 in “remove unnecessary 'if'”
  1. remove unnecessary 'if'Alexander Potashev, Dec 10, 2008
  2. Alexander PotashevDec 14, 2008

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.