summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-12-22 12:27:16 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-12-22 12:27:16 -0800
commit2f17ecbd8d58c79e76767da82cf824840dfd367f (patch)
treeeb6f57c76e79155a84fc74820856354b160399fa /git-compat-util.h
parentMerge branch 'ps/new-workdir-into-empty-directory' (diff)
parentcompat: convert modes to use portable file type values (diff)
downloadtgif-2f17ecbd8d58c79e76767da82cf824840dfd367f.tar.xz
Merge branch 'dm/compat-s-ifmt-for-zos'
Long overdue departure from the assumption that S_IFMT is shared by everybody made in 2005. * dm/compat-s-ifmt-for-zos: compat: convert modes to use portable file type values
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index cef2691276..b763a4e269 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -475,6 +475,40 @@ extern int git_munmap(void *start, size_t length);
#define on_disk_bytes(st) ((st).st_blocks * 512)
#endif
+#ifdef NEEDS_MODE_TRANSLATION
+#undef S_IFMT
+#undef S_IFREG
+#undef S_IFDIR
+#undef S_IFLNK
+#undef S_IFBLK
+#undef S_IFCHR
+#undef S_IFIFO
+#undef S_IFSOCK
+#define S_IFMT 0170000
+#define S_IFREG 0100000
+#define S_IFDIR 0040000
+#define S_IFLNK 0120000
+#define S_IFBLK 0060000
+#define S_IFCHR 0020000
+#define S_IFIFO 0010000
+#define S_IFSOCK 0140000
+#ifdef stat
+#undef stat
+#endif
+#define stat(path, buf) git_stat(path, buf)
+extern int git_stat(const char *, struct stat *);
+#ifdef fstat
+#undef fstat
+#endif
+#define fstat(fd, buf) git_fstat(fd, buf)
+extern int git_fstat(int, struct stat *);
+#ifdef lstat
+#undef lstat
+#endif
+#define lstat(path, buf) git_lstat(path, buf)
+extern int git_lstat(const char *, struct stat *);
+#endif
+
#define DEFAULT_PACKED_GIT_LIMIT \
((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256))