summaryrefslogtreecommitdiff
path: root/compat/cygwin.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-02 15:09:54 -0700
committerJunio C Hamano <gitster@pobox.com>2013-04-02 15:09:54 -0700
commit76d1ab30a3ad1c3bf406efb60c55b00a566f9050 (patch)
tree9b304604709131edb97f316277c9f80dba4faa58 /compat/cygwin.c
parent37ba4c61d04d0782bd34971be5cc4eec10f59d36 (diff)
parent0117c2f043183fb99e9b046b0df7d64c1b296624 (diff)
Merge branch 'tb/cygwin-shared-repository'
Cygwin port has a faster-but-lying lstat(2) emulation whose incorrectness does not matter in practice except for a few codepaths, and setting permission bits to directories is a codepath that needs to use a more correct one. * tb/cygwin-shared-repository: Make core.sharedRepository work under cygwin 1.7
Diffstat (limited to 'compat/cygwin.c')
-rw-r--r--compat/cygwin.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/cygwin.c b/compat/cygwin.c
index 5428858875..871b41d23a 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -1,3 +1,4 @@
+#define CYGWIN_C
#define WIN32_LEAN_AND_MEAN
#ifdef CYGWIN_V15_WIN32API
#include "../git-compat-util.h"
@@ -10,6 +11,18 @@
#endif
#include "../cache.h" /* to read configuration */
+/*
+ * Return POSIX permission bits, regardless of core.ignorecygwinfstricks
+ */
+int cygwin_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;
+}
+
static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts)
{
long long winTime = ((long long)ft->dwHighDateTime << 32) +