Re: [PATCH] remove unnecessary loop
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 8, 2007, 05:05 UTC
- Message-ID
- <7virb352ha.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <4640015F.1080407@gmail.com>
Liu Yubao <yubao.liu@gmail.com> writes:
> Here is a ugly fix, I don't hope it will be merged into git tree as it's not > git's fault, I will file a bug report for Cygwin.
Show 13 quoted lines
> @@ -50,9 +53,18 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
> continue;
>
> /* Existing file? We must have ignored it */
> +#ifdef __CYGWIN__
> + /*
> + * On cygwin, lstat("hello", &st) returns 0 when
> + * "hello.exe" exists, so test with open() again.
> + */
> + if (lstat(match, &st) && -1 != (fd = open(match, O_RDONLY))) {
> + struct dir_entry *ent;
> + close(fd);
> +#elseWe have lstat() everywhere, so if we were to work this around without (or "waiting for") a proper fix on the Cygwin side, you would be better off wrapping the above sequence in a separate function (say "sane_lstat()"), and do
#ifdef __CYGWIN__
#define lstat(a,b) sane_lstat(a,b)
#endifsomewhere near the top of git-compat-util.h