Re: [PATCH 2/3] t1301-*.sh: Fix the 'forced modes' test on cygwin
- From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
- Date
- Jun 18, 2011, 19:04 UTC
- Message-ID
- <4DFCF6AF.3060502@ramsay1.demon.co.uk>
- In-Reply-To
- <4DFB0C66.5080904@kdbg.org>
Johannes Sixt wrote:
Show 9 quoted lines
> BTW, it seems the patch fixes a bug when the two config parameters are > not assigned a value: the initialization looks like this[*]: > > static int native_stat = 1; > static int core_filemode; > > i.e., the default value of core.filemode seen by compat/cygwin.c is > actually false, and the fast native l/stat would be used, contrary to > the documentation. Am I missing something?
No, that is indeed a bug. See commit 7974843 (compat/cygwin.c: make runtime detection of lstat/stat lessor impact, 23-10-2008).
That commit "taught" me to always change the core.filemode key set up by git-init by changing the value ("false" -> "true"), *not* by simply deleting that line in .git/config. Otherwise, you end up with the "trust_executable_bit" (aka core.filemode) set to 1 and core_filemode set to 0. This leads to yet more schizophrenic behaviour; for example, in my cygwin git repo:
$ git diff-files -p
$ vim .git/config # remove the core.filemode key
$ git diff-files -p
diff --git a/.gitattributes b/.gitattributes
diff --git a/.gitignore b/.gitignore
diff --git a/.mailmap b/.mailmap
diff --git a/COPYING b/COPYING
diff --git a/Documentation/.gitattributes b/Documentation/.gitattributes
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
...
diff --git a/check-builtins.sh b/check-builtins.sh
old mode 100755
new mode 100644
diff --git a/check-racy.c b/check-racy.c
diff --git a/check_bindir b/check_bindir
old mode 100755
new mode 100644
diff --git a/color.c b/color.c
...
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
diff --git a/xdiff/xutils.h b/xdiff/xutils.h
diff --git a/zlib.c b/zlib.c
$ git diff-files -p | wc -l
3438
$ git diff-files -p | grep '^old mode' | wc -l
641
$ vim .git/config # put "core.filemode true" back in
$ git diff-files -p
$I had a patch in my cygwin repo which initialized core_filemode to 1 for ages, but never remembered to submit it. (I can't find it anymore, so I must have deleted that branch). Not that I actually ran a git with that patch applied.
ATB, Ramsay Jones