Skip to content

Commit f66450a

Browse files
Ramsay Jonesgitster
authored andcommitted
cygwin: Remove the Win32 l/stat() implementation
Commit adbc0b6 ("cygwin: Use native Win32 API for stat", 30-09-2008) added a Win32 specific implementation of the stat functions. In order to handle absolute paths, cygwin mount points and symbolic links, this implementation may fall back on the standard cygwin l/stat() functions. Also, the choice of cygwin or Win32 functions is made lazily (by the first call(s) to l/stat) based on the state of some config variables. Unfortunately, this "schizophrenic stat" implementation has been the source of many problems ever since. For example, see commits 7faee6b, 7974843, 452993c, 085479e, b8a9733, 924aaf3, 05bab3e and 0117c2f. In order to avoid further problems, such as the issue raised by the new reference handling API, remove the Win32 l/stat() implementation. Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 001b097 commit f66450a

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
@@ -170,7 +170,6 @@ ifeq ($(uname_O),Cygwin)
170170
# Try commenting this out if you suspect MMAP is more efficient
171171
NO_MMAP = YesPlease
172172
X = .exe
173-
COMPAT_OBJS += compat/cygwin.o
174173
UNRELIABLE_FSTAT = UnfortunatelyYes
175174
SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
176175
endif

contrib/completion/git-completion.bash

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,6 @@ _git_config ()
19571957
core.fileMode
19581958
core.fsyncobjectfiles
19591959
core.gitProxy
1960-
core.ignoreCygwinFSTricks
19611960
core.ignoreStat
19621961
core.ignorecase
19631962
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)