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

Re: [PATCH] Handle rename of case only, for Windows

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Feb 10, 2011, 18:58 UTC
Message-ID
<4D543546.1030207@ramsay1.demon.co.uk>
In-Reply-To
<1296344717.25999.1417928123@webmail.messagingengine.com>
[Sorry for the late reply to this... I'm somewhat backed-up!]
Tim Abell wrote:
>>From ddab003ede9f25d93f4e7eea833523a0aa29d16d Mon Sep 17 00:00:00 2001
> From: Tim Abell <tim@timwise.co.uk>
> Date: Thu, 27 Jan 2011 22:53:31 +0000
> Subject: [PATCH] Handle rename of case only, for Windows

This should not work with the MinGW or msvc build, since they *always* set the st_ino to zero (see do_lstat() and mingw_fstat() in compat/mingw.c). Also, *with default configuration*, it will also not work on cygwin... so saying that this works on Windows may be overstating things a bit ... ;-)

[Hmm, I can't check, but it would probably work on Mac OS X ...]
> Added test to show rename failing in windows.

This fails for me. (er... just to be clear, test #30 fails with your patch applied).

Show 6 quoted lines
> Added test to show that this patch doesn't break protection against overwriting
> an existing file, and another to show that "mv --force" still works.
> 
> Altered mv.c to check whether the source and destination file are actually
> the same file based on inode number before failing.
> If the inode is zero then the data is no use so old behaviour is maintained.

With default configuration, the st_ino will always be zero on cygwin. (see for example the "schizophrenic l/stat() functions" commits adbc0b6, 7faee6b and 7974843, along with the "force core.filemode" commit c869753).

So, you must have core.filemode or core.ignorecygwinfstricks set somewhere in your environment (in the system or global (user) config files?).

[I *always* set core.filemode after git-init or git-clone, so this patch may actually work for me *in practice* (I haven't tested it), but I may well not be a typical user...]

>> Hmm, not so good. st_ino is always 0 on Windows, so this would make
>> false positives, no?
> 
> I tested this on windows 7 under cygwin (which is what I have available) and st_ino reports real numbers for me,
Again, you must have non-default configuration set...

ATB, Ramsay Jones

Previous: Jonathan Nieder
Message 5 of 5 in “Handle rename of case only, for Windows”
  1. Handle rename of case only, for WindowsTim Abell, Jan 29, 2011
  2. René ScharfeJan 30, 2011
  3. Tim AbellJan 30, 2011
  4. Jonathan NiederJan 30, 2011
  5. Ramsay JonesFeb 10, 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.