Skip to content

Commit

Permalink
Merge branch 'rj/cygwin-clarify-use-of-cheating-lstat'
Browse files Browse the repository at this point in the history
Cygwin port added a "not quite correct but a lot faster and good
enough for many lstat() calls that are only used to see if the
working tree entity matches the index entry" lstat() emulation some
time ago, and it started biting us in places.  This removes it and
uses the standard lstat() that comes with Cygwin.

Recent topic that uses lstat on packed-refs file is broken when
this cheating lstat is used, and this is a simplest fix that is
also the cleanest direction to go in the long run.

* rj/cygwin-clarify-use-of-cheating-lstat:
  cygwin: Remove the Win32 l/stat() implementation
  • Loading branch information
Junio C Hamano committed Aug 2, 2013
2 parents c7eb614 + f66450a commit d6cbf2f
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 200 deletions.
11 changes: 0 additions & 11 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,6 @@ The default is true, except linkgit:git-clone[1] or linkgit:git-init[1]
will probe and set core.fileMode false if appropriate when the
repository is created.

core.ignoreCygwinFSTricks::
This option is only used by Cygwin implementation of Git. If false,
the Cygwin stat() and lstat() functions are used. This may be useful
if your repository consists of a few separate directories joined in
one hierarchy using Cygwin mount. If true, Git uses native Win32 API
whenever it is possible and falls back to Cygwin functions only to
handle symbol links. The native mode is more than twice faster than
normal Cygwin l/stat() functions. True by default, unless core.filemode
is true, in which case ignoreCygwinFSTricks is ignored as Cygwin's
POSIX emulation is required to support core.filemode.

core.ignorecase::
If true, this option enables various workarounds to enable
Git to work better on filesystems that are not case sensitive,
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ LIB_H += color.h
LIB_H += column.h
LIB_H += commit.h
LIB_H += compat/bswap.h
LIB_H += compat/cygwin.h
LIB_H += compat/mingw.h
LIB_H += compat/obstack.h
LIB_H += compat/poll/poll.h
Expand Down
157 changes: 0 additions & 157 deletions compat/cygwin.c

This file was deleted.

14 changes: 0 additions & 14 deletions compat/cygwin.h

This file was deleted.

1 change: 0 additions & 1 deletion config.mak.uname
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ ifeq ($(uname_O),Cygwin)
NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
X = .exe
COMPAT_OBJS += compat/cygwin.o
UNRELIABLE_FSTAT = UnfortunatelyYes
SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
endif
Expand Down
1 change: 0 additions & 1 deletion contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,6 @@ _git_config ()
core.fileMode
core.fsyncobjectfiles
core.gitProxy
core.ignoreCygwinFSTricks
core.ignoreStat
core.ignorecase
core.logAllRefUpdates
Expand Down
3 changes: 0 additions & 3 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@
#include <poll.h>
#endif

extern int get_st_mode_bits(const char *path, int *mode);

#if defined(__MINGW32__)
/* pull in Windows compatibility stuff */
#include "compat/mingw.h"
Expand Down Expand Up @@ -171,7 +169,6 @@ typedef unsigned long uintptr_t;
#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>
Expand Down
5 changes: 1 addition & 4 deletions help.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ static int is_executable(const char *name)
!S_ISREG(st.st_mode))
return 0;

#if defined(GIT_WINDOWS_NATIVE) || defined(__CYGWIN__)
#if defined(__CYGWIN__)
if ((st.st_mode & S_IXUSR) == 0)
#endif
#if defined(GIT_WINDOWS_NATIVE)
{ /* cannot trust the executable bit, peek into the file instead */
char buf[3] = { 0 };
int n;
Expand Down
9 changes: 1 addition & 8 deletions path.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@
#include "strbuf.h"
#include "string-list.h"

#ifndef get_st_mode_bits
/*
* The replacement lstat(2) we use on Cygwin is incomplete and
* may return wrong permission bits. Most of the time we do not care,
* but the callsites of this wrapper do care.
*/
int get_st_mode_bits(const char *path, int *mode)
static int get_st_mode_bits(const char *path, int *mode)
{
struct stat st;
if (lstat(path, &st) < 0)
return -1;
*mode = st.st_mode;
return 0;
}
#endif

static char bad_path[] = "/bad-path/";

Expand Down

0 comments on commit d6cbf2f

Please sign in to comment.