diff options
author | Mark Levedahl <mlevedahl@gmail.com> | 2008-10-13 00:33:31 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-10-13 13:43:24 -0700 |
commit | 7faee6b8de836904227ee98dc3d2c4c75b0ef3a1 (patch) | |
tree | a5522684e7f80e160b58b72f20861097839098bd /compat | |
parent | 5c283eb13c94be6ca974aa722159dc9838d10d97 (diff) | |
download | git-7faee6b8de836904227ee98dc3d2c4c75b0ef3a1.tar.gz |
compat/cygwin.c - Use cygwin's stat if core.filemode == true
Cygwin's POSIX emulation allows use of core.filemode true, unlike native
Window's implementation of stat / lstat, and Cygwin/git users who have
configured core.filemode true in various repositories will be very
unpleasantly surprised to find that git is no longer honoring that option.
So, this patch forces use of Cygwin's stat functions if core.filemode is
set true, regardless of any other considerations.
Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r-- | compat/cygwin.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/compat/cygwin.c b/compat/cygwin.c index 423ff20b0e..f1967532ba 100644 --- a/compat/cygwin.c +++ b/compat/cygwin.c @@ -91,22 +91,32 @@ static int cygwin_stat(const char *path, struct stat *buf) * functions should be used. The choice is determined by core.ignorecygwinfstricks. * Reading this option is not always possible immediately as git_dir may be * not be set yet. So until it is set, use cygwin lstat/stat functions. + * However, if the trust_executable_bit is set, we must use the Cygwin posix + * stat/lstat as the Windows stat fuctions do not determine posix filemode. */ static int native_stat = 1; +extern int trust_executable_bit; static int git_cygwin_config(const char *var, const char *value, void *cb) { - if (!strcmp(var, "core.ignorecygwinfstricks")) + if (!strcmp(var, "core.ignorecygwinfstricks")) { native_stat = git_config_bool(var, value); - return 0; + return 0; + } + return git_default_config(var, value, cb); } static int init_stat(void) { if (have_git_dir()) { git_config(git_cygwin_config, NULL); - cygwin_stat_fn = native_stat ? cygwin_stat : stat; - cygwin_lstat_fn = native_stat ? cygwin_lstat : lstat; + if (!trust_executable_bit && native_stat) { + cygwin_stat_fn = cygwin_stat; + cygwin_lstat_fn = cygwin_lstat; + } else { + cygwin_stat_fn = stat; + cygwin_lstat_fn = lstat; + } return 0; } return 1; |