1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-03 14:36:10 +02:00
git/compat
Dmitry Potapov adbc0b6b6e 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>
2008-09-30 14:30:06 -07:00
..
fnmatch Use compatibility regex library for OSX/Darwin 2008-09-10 13:36:40 -07:00
regex Use compatibility regex library for OSX/Darwin 2008-09-10 13:36:40 -07:00
cygwin.c cygwin: Use native Win32 API for stat 2008-09-30 14:30:06 -07:00
cygwin.h cygwin: Use native Win32 API for stat 2008-09-30 14:30:06 -07:00
fopen.c compat/fopen.c: avoid clobbering the system defined fopen macro 2008-05-08 17:43:01 -07:00
hstrerror.c Add a local implementation of hstrerror for the system which do not have it 2007-06-15 22:48:34 -07:00
inet_ntop.c Remove a couple of duplicated include 2007-11-05 20:50:38 -08:00
inet_pton.c Remove a couple of duplicated include 2007-11-05 20:50:38 -08:00
memmem.c add memmem() 2007-09-06 22:46:00 -07:00
mingw.c mingw: move common functionality to win32.h 2008-09-30 14:30:06 -07:00
mingw.h Revert "Windows: Use a customized struct stat that also has the st_blocks member." 2008-08-18 22:41:16 -07:00
mkdtemp.c Define compat version of mkdtemp for systems lacking it 2007-10-20 22:52:21 -04:00
mmap.c War on whitespace 2007-06-07 00:04:01 -07:00
pread.c Replacing the system call pread() with lseek()/xread()/lseek() sequence. 2007-01-09 16:40:40 -08:00
qsort.c compat: Add simplified merge sort implementation from glibc 2008-02-06 22:35:28 -08:00
setenv.c simplify inclusion of system header files. 2006-12-20 09:51:35 -08:00
snprintf.c compat/snprintf.c: handle snprintf's that always return the # chars transmitted 2008-08-21 01:53:44 -07:00
strcasestr.c Clean up compatibility definitions. 2005-12-05 15:50:29 -08:00
strlcpy.c simplify inclusion of system header files. 2006-12-20 09:51:35 -08:00
strtoumax.c Add a compat/strtoumax.c for Solaris 8. 2007-02-19 18:20:30 -08:00
unsetenv.c simplify inclusion of system header files. 2006-12-20 09:51:35 -08:00
win32.h mingw: move common functionality to win32.h 2008-09-30 14:30:06 -07:00
winansi.c Add ANSI control code emulation for the Windows console 2008-07-19 11:17:43 -07:00