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
Junio C Hamano <gitster@pobox.com>
Date
Jun 17, 2011, 21:27 UTC
Message-ID
<7vsjr8f8sl.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4DFB0C66.5080904@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 25 quoted lines
>>  static int init_stat(void)
>>  {
>> -	if (have_git_dir()) {
>> -		git_config(git_cygwin_config, NULL);
>> +	if (have_git_dir() && git_config(git_cygwin_config,NULL)) {
>>  		if (!core_filemode && native_stat) {
>>  			cygwin_stat_fn = cygwin_stat;
>>  			cygwin_lstat_fn = cygwin_lstat;
>
> So, this means that if neither core.filemode nor
> core.ignorecygwinfstricks is assigned a value, then regular (Cygwin's)
> l/stat is used. Ok, that's what we need: the default value of
> core.filemode is true, which means we need Cygwin's l/stat; it trumps
> the default value of core.ignorecygwinfstricks, which is also
> true. Good!
>
> 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?

Probably you are not missing anything. It is a regression introduced by 7974843 (compat/cygwin.c: make runtime detection of lstat/stat lessor impact, 2008-10-23).

What the added "&& git_config()" is doing is that until we actually open and read .git/config and the like, we do not take that if (), meaning we leave the cygwin_stat_fn pointing at the cygwin_stat_stub (same for lstat), using the "unoptimized" cygwin version. Once we do read from config we are likely to have core.filemode defined (prepared by git init), so the "default" value here would probably not matter in practice.

Previous: Johannes SixtNext: Ramsay Jones
Message 5 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.