git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Johannes Sixt <j6t@kdbg.org>
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: Thu, 16 Dec 2010 21:12:37 +0000	[thread overview]
Message-ID: <4D0A80C5.4020003@ramsay1.demon.co.uk> (raw)
In-Reply-To: <201012142138.37679.j6t@kdbg.org>

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?

ATB,
Ramsay Jones

  reply	other threads:[~2010-12-16 22:41 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 [this message]
2010-12-17 21:46     ` Johannes Sixt
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=4D0A80C5.4020003@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jrnieder@gmail.com \
    --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).