From adbc0b6b6e57c11ca49779d01f549260a920a97d Mon Sep 17 00:00:00 2001 From: Dmitry Potapov Date: Tue, 30 Sep 2008 17:53:47 +0400 Subject: 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 Signed-off-by: Shawn O. Pearce --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e0c03c3eec..7db2ccc296 100644 --- a/Makefile +++ b/Makefile @@ -346,6 +346,7 @@ LIB_H += cache.h LIB_H += cache-tree.h LIB_H += commit.h LIB_H += compat/mingw.h +LIB_H += compat/cygwin.h LIB_H += csum-file.h LIB_H += decorate.h LIB_H += delta.h @@ -748,6 +749,9 @@ ifeq ($(uname_S),HP-UX) NO_SYS_SELECT_H = YesPlease SNPRINTF_RETURNS_BOGUS = YesPlease endif +ifneq (,$(findstring CYGWIN,$(uname_S))) + COMPAT_OBJS += compat/cygwin.o +endif ifneq (,$(findstring MINGW,$(uname_S))) NO_MMAP = YesPlease NO_PREAD = YesPlease -- cgit v1.2.3