Skip to content

Commit d6cbf2f

Browse files
committed
Merge branch 'rj/cygwin-clarify-use-of-cheating-lstat'
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
2 parents c7eb614 + f66450a commit d6cbf2f

File tree

9 files changed

+2
-200
lines changed

9 files changed

+2
-200
lines changed

Documentation/config.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,6 @@ The default is true, except linkgit:git-clone[1] or linkgit:git-init[1]
213213
will probe and set core.fileMode false if appropriate when the
214214
repository is created.
215215

216-
core.ignoreCygwinFSTricks::
217-
This option is only used by Cygwin implementation of Git. If false,
218-
the Cygwin stat() and lstat() functions are used. This may be useful
219-
if your repository consists of a few separate directories joined in
220-
one hierarchy using Cygwin mount. If true, Git uses native Win32 API
221-
whenever it is possible and falls back to Cygwin functions only to
222-
handle symbol links. The native mode is more than twice faster than
223-
normal Cygwin l/stat() functions. True by default, unless core.filemode
224-
is true, in which case ignoreCygwinFSTricks is ignored as Cygwin's
225-
POSIX emulation is required to support core.filemode.
226-
227216
core.ignorecase::
228217
If true, this option enables various workarounds to enable
229218
Git to work better on filesystems that are not case sensitive,

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,6 @@ LIB_H += color.h
654654
LIB_H += column.h
655655
LIB_H += commit.h
656656
LIB_H += compat/bswap.h
657-
LIB_H += compat/cygwin.h
658657
LIB_H += compat/mingw.h
659658
LIB_H += compat/obstack.h
660659
LIB_H += compat/poll/poll.h

compat/cygwin.c

Lines changed: 0 additions & 157 deletions
This file was deleted.

compat/cygwin.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

config.mak.uname

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ ifeq ($(uname_O),Cygwin)
171171
NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
172172
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
173173
X = .exe
174-
COMPAT_OBJS += compat/cygwin.o
175174
UNRELIABLE_FSTAT = UnfortunatelyYes
176175
SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
177176
endif

contrib/completion/git-completion.bash

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,6 @@ _git_config ()
19581958
core.fileMode
19591959
core.fsyncobjectfiles
19601960
core.gitProxy
1961-
core.ignoreCygwinFSTricks
19621961
core.ignoreStat
19631962
core.ignorecase
19641963
core.logAllRefUpdates

git-compat-util.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@
129129
#include <poll.h>
130130
#endif
131131

132-
extern int get_st_mode_bits(const char *path, int *mode);
133-
134132
#if defined(__MINGW32__)
135133
/* pull in Windows compatibility stuff */
136134
#include "compat/mingw.h"
@@ -171,7 +169,6 @@ typedef unsigned long uintptr_t;
171169
#undef _XOPEN_SOURCE
172170
#include <grp.h>
173171
#define _XOPEN_SOURCE 600
174-
#include "compat/cygwin.h"
175172
#else
176173
#undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
177174
#include <grp.h>

help.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ static int is_executable(const char *name)
107107
!S_ISREG(st.st_mode))
108108
return 0;
109109

110-
#if defined(GIT_WINDOWS_NATIVE) || defined(__CYGWIN__)
111-
#if defined(__CYGWIN__)
112-
if ((st.st_mode & S_IXUSR) == 0)
113-
#endif
110+
#if defined(GIT_WINDOWS_NATIVE)
114111
{ /* cannot trust the executable bit, peek into the file instead */
115112
char buf[3] = { 0 };
116113
int n;

path.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@
55
#include "strbuf.h"
66
#include "string-list.h"
77

8-
#ifndef get_st_mode_bits
9-
/*
10-
* The replacement lstat(2) we use on Cygwin is incomplete and
11-
* may return wrong permission bits. Most of the time we do not care,
12-
* but the callsites of this wrapper do care.
13-
*/
14-
int get_st_mode_bits(const char *path, int *mode)
8+
static int get_st_mode_bits(const char *path, int *mode)
159
{
1610
struct stat st;
1711
if (lstat(path, &st) < 0)
1812
return -1;
1913
*mode = st.st_mode;
2014
return 0;
2115
}
22-
#endif
2316

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

0 commit comments

Comments
 (0)