diff options
author | Dmitry Potapov <dpotapov@gmail.com> | 2008-09-30 17:53:47 +0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-09-30 14:30:06 -0700 |
commit | adbc0b6b6e57c11ca49779d01f549260a920a97d (patch) | |
tree | e2e7f5552e8a0b0775a11acc57eea69d04fe364f /git-compat-util.h | |
parent | 444dc90322fcd1e4ea1cb9c6a46372fa28d8ef9d (diff) | |
download | git-adbc0b6b6e57c11ca49779d01f549260a920a97d.tar.gz |
cygwin: Use native Win32 API for stat
lstat/stat functions in Cygwin are very slow, because they try to emulate
some *nix things that Git does not actually need. This patch adds Win32
specific implementation of these functions for Cygwin.
This implementation handles most situation directly but in some rare cases
it falls back on the implementation provided for Cygwin. This is necessary
for two reasons:
- Cygwin has its own file hierarchy, so absolute paths used in Cygwin is
not suitable to be used Win32 API. cygwin_conv_to_win32_path can not be
used because it automatically dereference Cygwin symbol links, also it
causes extra syscall. Fortunately Git rarely use absolute paths, so we
always use Cygwin implementation for absolute paths.
- Support of symbol links. Cygwin stores symbol links as ordinary using
one of two possible formats. Therefore, the fast implementation falls
back to Cygwin functions if it detects potential use of symbol links.
The speed of this implementation should be the same as mingw_lstat for
common cases, but it is considerable slower when the specified file name
does not exist.
Despite all efforts to make the fast implementation as robust as possible,
it may not work well for some very rare situations. I am aware only one
situation: use Cygwin mount to bind unrelated paths inside repository
together. Therefore, the core.ignoreCygwinFSTricks configuration option is
provided, which controls whether native or Cygwin version of stat is used.
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index 2ac832f3b4..e20b1e858c 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -85,6 +85,7 @@ #undef _XOPEN_SOURCE #include <grp.h> #define _XOPEN_SOURCE 600 +#include "compat/cygwin.h" #else #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */ #include <grp.h> |