git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/1] Fix a recently-introduced compile warning
@ 2018-08-14 11:02 Johannes Schindelin via GitGitGadget
  2018-08-14 11:02 ` [PATCH 1/1] mark_colliding_entries(): fix incorrect #if...#endif guard Johannes Schindelin via GitGitGadget
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2018-08-14 11:02 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

With the relatively frequent breakages of pu recently, I had trouble staying
on top of the compile errors/test failures, sorry.

This one exists since Sunday, and it is a compile error only with 
DEVELOPER=1, which is, however, the recommended way to build in Git for
Windows' SDK.

Note: it is based on nd/clone-case-smashing-warning.

Johannes Schindelin (1):
  mark_colliding_entries(): fix incorrect #if...#endif guard

 entry.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


base-commit: f80218bf4e65ccc06cc9173c0ac5a5520d380f36
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-18%2Fdscho%2Fclone-case-smashing-warning-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-18/dscho/clone-case-smashing-warning-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/18
-- 
gitgitgadget

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

* [PATCH 1/1] mark_colliding_entries(): fix incorrect #if...#endif guard
  2018-08-14 11:02 [PATCH 0/1] Fix a recently-introduced compile warning Johannes Schindelin via GitGitGadget
@ 2018-08-14 11:02 ` Johannes Schindelin via GitGitGadget
  2018-08-14 15:08   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2018-08-14 11:02 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

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

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

* Re: [PATCH 1/1] mark_colliding_entries(): fix incorrect #if...#endif guard
  2018-08-14 11:02 ` [PATCH 1/1] mark_colliding_entries(): fix incorrect #if...#endif guard Johannes Schindelin via GitGitGadget
@ 2018-08-14 15:08   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2018-08-14 15:08 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy,
	Johannes Schindelin via GitGitGadget
  Cc: git, Johannes Schindelin

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> 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;
>  }

Even though it looks a bit odd to smudge 'ce' itself after the loop,
I think this would not break anything, simply because the loop does
treat the 'ce' as special and stops the iteration once it sees it,
even before its MATCHED bit is set.

Duy, if you are going to send a new version updated for other
reasons, please squash this in.  In the meantime, I'll queue it on
top of what we have right now.

Thanks, both.


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

end of thread, other threads:[~2018-08-14 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-14 11:02 [PATCH 0/1] Fix a recently-introduced compile warning Johannes Schindelin via GitGitGadget
2018-08-14 11:02 ` [PATCH 1/1] mark_colliding_entries(): fix incorrect #if...#endif guard Johannes Schindelin via GitGitGadget
2018-08-14 15:08   ` Junio C Hamano

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).