Subject: Re: [PATCH] add GIT_FAST_STAT mode for Cygwin

From: "Shawn O. Pearce" <[email-masked]>
Date: Tue, 23 Sep 2008 08:31:48 -0700

Dmitry Potapov <[email-masked]> wrote:
> This patch introduces the GIT_FAST_STAT environment variable. If this
> variable is not set then Git will work as before. However, if it is set
> then the Cygwin version of Git will try to use a Win32 API function if
> it is possible to speed up stat/lstat.
> 
> This fast mode works only for relative paths. It is assumed that the
> whole repository is located inside one directory without using Cygwin
> mount to bind external paths inside of the current tree.
...
> +/*
> + * This are startup stubs, which choose what implementation of lstat/stat
> + * should be used. If GIT_FAST_STAT is not set then the standard functions
> + * included in the cygwin library are used. If it is set then our fast and
> + * dirty implementation is invoked, which should be 2-3 times faster than
> + * cygwin functions.
> + */
> +static int cygwin_stat_choice(const char *file_name, struct stat *buf)
> +{
> +	cygwin_stat_fn = getenv("GIT_FAST_STAT") ?
> +		cygwin_stat : stat;
> +	return (*cygwin_stat_fn)(file_name, buf);
> +}
> +
> +static int cygwin_lstat_choice(const char *file_name, struct stat *buf)
> +{
> +	cygwin_lstat_fn = getenv("GIT_FAST_STAT") ?
> +		cygwin_lstat : lstat;
> +	return (*cygwin_lstat_fn)(file_name, buf);
> +}

I wonder, should this be controlled by an environment variable?

Given your description of the feature it seems to be more a property
of the specific repository, as it is based upon where the repository
lives within the Cygwin namespace.  Should this be controlled instead
by say a "core.cygwinnativestat = true" configuration property?

-- 
Shawn.