git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “t1301-*.sh: Fix the 'forced modes' test on cygwin”
  1. 2/3 t1301-*.sh: Fix the 'forced modes' test on cygwinRamsay Jones, Jun 16, 2011
  2. Junio C HamanoJun 16, 2011
  3. Ramsay JonesJun 17, 2011
  4. Johannes SixtJun 17, 2011
  5. Junio C HamanoJun 17, 2011
  6. Ramsay JonesJun 18, 2011
  7. Re* [PATCH 2/3] t1301-*.sh: Fix the 'forced modes' test on cygwinJunio C Hamano, Jun 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.