summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 304d058)
raw | patch | inline | side by side (parent: 304d058)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 24 Oct 2008 05:54:09 +0000 (22:54 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 28 Oct 2008 16:12:49 +0000 (09:12 -0700) |
The original patch that lead to an earlier commit adbc0b6 (cygwin: Use
native Win32 API for stat, 2008-09-30) did not call git_default_config()
and it was a good thing. The lazy config reading when lstat/stat is
called for the first time to find out if core.filemode is set can happen
anytime in the calling program. If it happens after the calling program
parsed the configuration file to prime its default parameter settings and
processed its command line parameters to tweak them, this will overwrite
the values set by the program with the values read from the config file.
This essentially reverts the code to the version as submitted by Mark,
with a bit more comments to clarify why we do not fall back on the default
configuration parser from git_cygwin_config().
Signed-off-by: Junio C Hamano <gitster@pobox.com>
native Win32 API for stat, 2008-09-30) did not call git_default_config()
and it was a good thing. The lazy config reading when lstat/stat is
called for the first time to find out if core.filemode is set can happen
anytime in the calling program. If it happens after the calling program
parsed the configuration file to prime its default parameter settings and
processed its command line parameters to tweak them, this will overwrite
the values set by the program with the values read from the config file.
This essentially reverts the code to the version as submitted by Mark,
with a bit more comments to clarify why we do not fall back on the default
configuration parser from git_cygwin_config().
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/cygwin.c | patch | blob | history |
diff --git a/compat/cygwin.c b/compat/cygwin.c
index f1967532bae87cbe3627b065083cc56ca0b64550..ebac1483929c798905e6558e0013e3de3d6abeb2 100644 (file)
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
* 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
+ * However, if core.filemode is set, we must use the Cygwin posix
* stat/lstat as the Windows stat fuctions do not determine posix filemode.
+ *
+ * Note that git_cygwin_config() does NOT call git_default_config() and this
+ * is deliberate. Many commands read from config to establish initial
+ * values in variables and later tweak them from elsewhere (e.g. command line).
+ * init_stat() is called lazily on demand, typically much late in the program,
+ * and calling git_default_config() from here would break such variables.
*/
static int native_stat = 1;
-extern int trust_executable_bit;
+static int core_filemode;
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 git_default_config(var, value, cb);
+ else if (!strcmp(var, "core.filemode"))
+ core_filemode = git_config_bool(var, value);
+ return 0;
}
static int init_stat(void)
{
if (have_git_dir()) {
git_config(git_cygwin_config, NULL);
- if (!trust_executable_bit && native_stat) {
+ if (!core_filemode && native_stat) {
cygwin_stat_fn = cygwin_stat;
cygwin_lstat_fn = cygwin_lstat;
} else {