From: Johannes Sixt <j6t@kdbg.org>
To: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Junio C Hamano <gitster@pobox.com>,
"GIT Mailing-list" <git@vger.kernel.org>,
jrnieder@gmail.com, vmiklos@frugalware.org
Subject: Re: [PATCH 08/14] help.c: Fix detection of custom merge strategy on cygwin
Date: Fri, 17 Dec 2010 22:46:44 +0100 [thread overview]
Message-ID: <201012172246.45038.j6t@kdbg.org> (raw)
In-Reply-To: <4D0A80C5.4020003@ramsay1.demon.co.uk>
On Donnerstag, 16. Dezember 2010, Ramsay Jones wrote:
> Johannes Sixt wrote:
> > On Dienstag, 14. Dezember 2010, Ramsay Jones wrote:
> >> @@ -126,7 +126,10 @@ static int is_executable(const char *name)
> >> !S_ISREG(st.st_mode))
> >> return 0;
> >>
> >> -#ifdef WIN32
> >> +#if defined(WIN32) || defined(__CYGWIN__)
> >> +#if defined(__CYGWIN__)
> >> +if ((st.st_mode & S_IXUSR) == 0)
> >> +#endif
> >> { /* cannot trust the executable bit, peek into the file instead */
> >> char buf[3] = { 0 };
> >> int n;
> >
> > Do you gain a lot by this extra condition? Wouldn't
> >
> > -#ifdef WIN32
> > +#if defined(WIN32) || defined(__CYGWIN__)
> >
> > be sufficient?
>
> Yes, that would be sufficient. No, I probably don't gain a great deal
> (but I have *not* timed it), since the number of files that are tested
> by is_executable() is fairly low anyway since they are already filtered
> by a filename prefix (eg. git-merge-).
>
> However, if the executable bit is set, then executing the WIN32 code
> block is wasted effort (we already know the answer), so why bother?
It would have made to code a bit easier to read with one less #if defined(),
but it's not a big deal.
-- Hannes
next prev parent reply other threads:[~2010-12-17 21:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-14 18:29 [PATCH 08/14] help.c: Fix detection of custom merge strategy on cygwin Ramsay Jones
2010-12-14 20:07 ` Erik Faye-Lund
2010-12-16 21:03 ` Ramsay Jones
2010-12-16 23:06 ` Erik Faye-Lund
2010-12-14 20:38 ` Johannes Sixt
2010-12-16 21:12 ` Ramsay Jones
2010-12-17 21:46 ` Johannes Sixt [this message]
2010-12-18 20:41 ` Ramsay Jones
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=201012172246.45038.j6t@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=ramsay@ramsay1.demon.co.uk \
--cc=vmiklos@frugalware.org \
/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).