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

Re: Odd Difference Between Windows Git and Standard Git

From
Torsten Bögershausen <tboegi@web.de>
Date
May 20, 2016, 16:12 UTC
Message-ID
<5067f10f-a12e-c6e6-493b-5ff14dae4380@web.de>
In-Reply-To
<xmqqy474g3cv.fsf@gitster.mtv.corp.google.com>
On 20.05.16 17:23, Junio C Hamano wrote:
Show 24 quoted lines
> Torsten Bögershausen <tboegi@web.de> writes:
> 
>>>> What does
>>>> git diff
>>>> say ?
>>>
>>> Great question. For all the unexpected files it says the
>>> same thing:
>>>
>>> old mode 100755
>>> new mode 100644
>>
>> So the solution is to run
>> git config  core.filemode false
> 
> Thanks for asking a great question.  I somehow expected that we
> probe in init-db.c::create_default_files() for this when we probe
> for case sensitivity, symlinks, etc., but apparently we don't.
> 
> I guess we don't because on some filesystems we can't.  IIRC, it
> goes something like: chmod immediately followed by lstat pretends
> that change to the executable bit stuck, until the in-core buffer at
> the vfs layer is flushed to the disk platter that holds the
> filesystem without any notion of executable bit.

We do the probing, when the repo is cloned, and then never again. If I clone the repo under Windows, the probing gives core.filemod false. If I clone under Linux, the probing gives core.filemod true.

Unfortunatly Git for Windows looks at core.filemode, when looking at the working tree, even if the stat() implementation never detects the executable bit.

A fix could look like this:
 
static int git_default_core_config(const char *var, const char *value)
{
	/* This needs a better name */
	if (!strcmp(var, "core.filemode")) {
#ifndef GIT_WINDOWS_NATIVE
		trust_executable_bit = git_config_bool(var, value);
#endif
		return 0;
	}
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 17 in “Odd Difference Between Windows Git and Standard Git”
  1. Jon ForrestMay 20, 2016
  2. Torsten BögershausenMay 20, 2016
  3. Jon ForrestMay 20, 2016
  4. Torsten BögershausenMay 20, 2016
  5. Jon ForrestMay 20, 2016
  6. Torsten BögershausenMay 20, 2016
  7. Junio C HamanoMay 20, 2016
  8. Torsten BögershausenMay 20, 2016
  9. Junio C HamanoMay 20, 2016
  10. Johannes SchindelinMay 23, 2016
  11. Jon ForrestMay 23, 2016
  12. Johannes SchindelinMay 23, 2016
  13. Junio C HamanoMay 23, 2016
  14. Torsten BögershausenMay 24, 2016
  15. Johannes SchindelinMay 24, 2016
  16. Torsten BögershausenMay 25, 2016
  17. Johannes SchindelinMay 25, 2016

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.