git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Alex Riesen" <raa.lkml@gmail.com>
Cc: "Mark Levedahl" <mlevedahl@gmail.com>,
	spearce@spearce.org, dpotapov@gmail.com, git@vger.kernel.org
Subject: Re: [PATCH] Only update the cygwin-related configuration during state auto-setup
Date: Thu, 23 Oct 2008 22:54:09 -0700	[thread overview]
Message-ID: <7viqri35dq.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <81b0412b0810230607sfea05ddm62bd03f837fc922e@mail.gmail.com> (Alex Riesen's message of "Thu, 23 Oct 2008 15:07:22 +0200")

"Alex Riesen" <raa.lkml@gmail.com> writes:

> Otherwise the other global settings which were already read and set up will
> be overwritten ...

This is the answer to the question I asked in:

 http://thread.gmane.org/gmane.comp.version-control.git/97986/focus=98066

Perhaps we should use a separate variable as the original patch did, in:

  http://article.gmane.org/gmane.comp.version-control.git/97987

How about doing it like this instead?


diff --git i/compat/cygwin.c w/compat/cygwin.c
index f196753..ebac148 100644
--- i/compat/cygwin.c
+++ w/compat/cygwin.c
@@ -91,26 +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
+ * 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 {

  parent reply	other threads:[~2008-10-24  5:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23 13:07 [PATCH] Only update the cygwin-related configuration during state auto-setup Alex Riesen
2008-10-23 18:36 ` Alex Riesen
2008-10-24  5:54 ` Junio C Hamano [this message]
2008-10-24  7:47   ` Alex Riesen
2008-10-27 10:20   ` Nanako Shiraishi
2008-10-28  3:27     ` Junio C Hamano
2008-10-28 12:21       ` Alex Riesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7viqri35dq.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=dpotapov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mlevedahl@gmail.com \
    --cc=raa.lkml@gmail.com \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).