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

[PATCH 1/1] mark_colliding_entries(): fix incorrect #if...#endif guard

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 14, 2018, 11:02 UTC
Message-ID
<becaf4374a1f8e56a4a26203d74ba64560a465da.1534244538.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.18.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

The way the guard was put, the code was declaring an unused variable on Windows. No need to do that, so let's fix it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 entry.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/entry.c b/entry.c
index c70340df8..2bce13352 100644
--- a/entry.c
+++ b/entry.c
@@ -402,11 +402,9 @@ static int check_path(const char *path, int len, struct stat *st, int skiplen)
 static void mark_colliding_entries(const struct checkout *state,
 				   struct cache_entry *ce, struct stat *st)
 {
+#if !defined(GIT_WINDOWS_NATIVE) /* inode is always zero on Windows */
 	int i;
 
-	ce->ce_flags |= CE_MATCHED;
-
-#if !defined(GIT_WINDOWS_NATIVE) /* inode is always zero on Windows */
 	for (i = 0; i < state->istate->cache_nr; i++) {
 		struct cache_entry *dup = state->istate->cache[i];
 
@@ -422,6 +420,8 @@ static void mark_colliding_entries(const struct checkout *state,
 		}
 	}
 #endif
+
+	ce->ce_flags |= CE_MATCHED;
 }
 
 /*
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Junio C Hamano
Message 2 of 3 in “Fix a recently-introduced compile warning”
  1. 0/1 Fix a recently-introduced compile warningJohannes Schindelin via GitGitGadget, Aug 14, 2018
  2. 1/1 mark_colliding_entries(): fix incorrect #if...#endif guardJohannes Schindelin via GitGitGadget, Aug 14, 2018
  3. Junio C HamanoAug 14, 2018

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.