git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 1/1] mark_colliding_entries(): fix incorrect #if...#endif guard
Date: Tue, 14 Aug 2018 08:08:38 -0700	[thread overview]
Message-ID: <xmqqva8d0yvd.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <becaf4374a1f8e56a4a26203d74ba64560a465da.1534244538.git.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Tue, 14 Aug 2018 04:02:21 -0700 (PDT)")

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


      reply	other threads:[~2018-08-14 15:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqva8d0yvd.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).