]> git.ipfire.org Git - thirdparty/git.git/commit - Makefile
cygwin: Use native Win32 API for stat
authorDmitry Potapov <dpotapov@gmail.com>
Tue, 30 Sep 2008 13:53:47 +0000 (17:53 +0400)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 30 Sep 2008 21:30:06 +0000 (14:30 -0700)
commitadbc0b6b6e57c11ca49779d01f549260a920a97d
treee2e7f5552e8a0b0775a11acc57eea69d04fe364f
parent444dc90322fcd1e4ea1cb9c6a46372fa28d8ef9d
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>
Documentation/config.txt
Makefile
compat/cygwin.c [new file with mode: 0644]
compat/cygwin.h [new file with mode: 0644]
git-compat-util.h