threads / bug / 41296

[bug] Possible Windows 'git mv' bug

Subject: [bug] Possible Windows 'git mv' bug

## tl;dr

7 messages between Jan 31, 2016 and Feb 1, 2016.

replies: 6people: 5as markdown or json

Aaron Gray· Jan 31, 2016, 14:03 UTC · lore
Hi,

I think I have found a possible difference in behaviour between Windows git commandline distro and Linux git

basically If I do a :-
    git mv logger.h Logger.h
I get the following :-
    fatal: destination exists, source=lib/logger.h, destination=lib/Logger.h
It looks and smells like a bug to me !
Regards,
Aaron
Johannes Sixt· Jan 31, 2016, 14:50 UTC · re: Aaron Gray · lore

Re: [bug] Possible Windows 'git mv' bug

Am 31.01.2016 um 15:03 schrieb Aaron Gray:
Show 14 quoted lines
> Hi,
>
> I think I have found a possible difference in behaviour between
> Windows git commandline distro and Linux git
>
> basically If I do a :-
>
>      git mv logger.h Logger.h
>
> I get the following :-
>
>      fatal: destination exists, source=lib/logger.h, destination=lib/Logger.h
>
> It looks and smells like a bug to me !

Not really. When you attempt to overwrite an existing file with 'git mv', you get this error message on both Windows and Linux.

The difference is that logger.h and Logger.h are the same file on Windows, but they are not on Linux. Hence, when you attempt to overwrite Logger.h on Windows, you see the error because it exists already (as logger.h).

As a work-around, you can use -f.
-- Hannes
Doug Kelly· Jan 31, 2016, 15:05 UTC · re: Johannes Sixt · lore

Re: [bug] Possible Windows 'git mv' bug

On Sun, Jan 31, 2016 at 8:50 AM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 29 quoted lines
> Am 31.01.2016 um 15:03 schrieb Aaron Gray:
>>
>> Hi,
>>
>> I think I have found a possible difference in behaviour between
>> Windows git commandline distro and Linux git
>>
>> basically If I do a :-
>>
>>      git mv logger.h Logger.h
>>
>> I get the following :-
>>
>>      fatal: destination exists, source=lib/logger.h,
>> destination=lib/Logger.h
>>
>> It looks and smells like a bug to me !
>
>
> Not really. When you attempt to overwrite an existing file with 'git mv',
> you get this error message on both Windows and Linux.
>
> The difference is that logger.h and Logger.h are the same file on Windows,
> but they are not on Linux. Hence, when you attempt to overwrite Logger.h on
> Windows, you see the error because it exists already (as logger.h).
>
> As a work-around, you can use -f.
>
> -- Hannes

Indeed. And just to clarify, you'll get the same issue on OS X, where the filesystem is also case-preserving, not case-sensitive (by default, at least). I've never tried using -f for this, but I'll usually use git mv twice to achieve the same result. Annoying, but that way my local directory looks correct, too.

Aaron Gray· Jan 31, 2016, 15:36 UTC · re: Doug Kelly · lore

Re: [bug] Possible Windows 'git mv' bug

On 31 January 2016 at 15:05, Doug Kelly <dougk.ff7@gmail.com> wrote:
Show 20 quoted lines
> On Sun, Jan 31, 2016 at 8:50 AM, Johannes Sixt <j6t@kdbg.org> wrote:
>> Am 31.01.2016 um 15:03 schrieb Aaron Gray:
>>> I think I have found a possible difference in behaviour between
>>> Windows git commandline distro and Linux git
>>>
>>> basically If I do a :-
>>>
>>>      git mv logger.h Logger.h
>>>
>>> I get the following :-
>>>
>>>      fatal: destination exists, source=lib/logger.h,
>>> destination=lib/Logger.h
>>>
>
> Indeed.  And just to clarify, you'll get the same issue on OS X, where
> the filesystem is also case-preserving, not case-sensitive (by
> default, at least).  I've never tried using -f for this, but I'll
> usually use git mv twice to achieve the same result.  Annoying, but
> that way my local directory looks correct, too.
Ah, double up via a temporary name, cool hack !
Aaron
Aaron Gray· Jan 31, 2016, 15:38 UTC · re: Johannes Sixt · lore

Re: [bug] Possible Windows 'git mv' bug

On 31 January 2016 at 14:50, Johannes Sixt <j6t@kdbg.org> wrote:
Show 27 quoted lines
> Am 31.01.2016 um 15:03 schrieb Aaron Gray:
>>
>> Hi,
>>
>> I think I have found a possible difference in behaviour between
>> Windows git commandline distro and Linux git
>>
>> basically If I do a :-
>>
>>      git mv logger.h Logger.h
>>
>> I get the following :-
>>
>>      fatal: destination exists, source=lib/logger.h,
>> destination=lib/Logger.h
>>
>> It looks and smells like a bug to me !
>
>
> Not really. When you attempt to overwrite an existing file with 'git mv',
> you get this error message on both Windows and Linux.
>
> The difference is that logger.h and Logger.h are the same file on Windows,
> but they are not on Linux. Hence, when you attempt to overwrite Logger.h on
> Windows, you see the error because it exists already (as logger.h).
>
> As a work-around, you can use -f.
Thanks Hannes !
Still a bug though IMHO
Aaron
Torsten Bögershausen· Jan 31, 2016, 15:52 UTC · re: Aaron Gray · lore

Re: [bug] Possible Windows 'git mv' bug

On 2016-01-31 15.03, Aaron Gray wrote:
Show 14 quoted lines
> Hi,
> 
> I think I have found a possible difference in behaviour between
> Windows git commandline distro and Linux git
> 
> basically If I do a :-
> 
>     git mv logger.h Logger.h
> 
> I get the following :-
> 
>     fatal: destination exists, source=lib/logger.h, destination=lib/Logger.h
> 
> It looks and smells like a bug to me !

Which version of Git are you using ? Because it is fixed in the latest version in Git and Git for Windows.

Johannes Schindelin· Feb 1, 2016, 06:32 UTC · re: Torsten Bögershausen · lore

Re: [bug] Possible Windows 'git mv' bug

Hi Aaron,
On Sun, 31 Jan 2016, Torsten Bögershausen wrote:
Show 14 quoted lines
> On 2016-01-31 15.03, Aaron Gray wrote:
> > 
> > I think I have found a possible difference in behaviour between
> > Windows git commandline distro and Linux git
> > 
> > basically If I do a :-
> > 
> >     git mv logger.h Logger.h
> > 
> > I get the following :-
> > 
> >     fatal: destination exists, source=lib/logger.h, destination=lib/Logger.h
> > 
> > It looks and smells like a bug to me !

Thanks for your bug report. Having said that, I would like to suggest a couple improvements for future reference:

Git for Windows' home page (https://git-for-windows.github.com/#contribute) asks explicitly to please open tickets on Git for Windows' bug tracker (https://github.com/git-for-windows/git/issues).

Also, at least one crucial bit of information is missing: the Git for Windows version. Typically this is enough, but the Windows version is often also crucial. To prevent crucial bits of information from missing, I highly recommend volunteering information up front (in my mind, a good rule of thumb is: spend as much care crafting your bug report and thinking about what to include as you would wish the combined readership would spend on helping you). If I may say so, I provided a good list of advices to help crafting bug reports: https://github.com/git-for-windows/git/wiki/Issue-reporting-guidelines

> Which version of Git are you using ?
> Because it is fixed in the latest version in Git and Git for Windows.

Another piece of advice I detail in our issue reporting guidelines is to search the existing bug tracker (one purpose of the tracker is to keep track of what has been reported and what has not yet been reported, after all).

And indeed, I opened this ticket:
	https://github.com/git-for-windows/git/issues/419

... whose initial report incidentally also lacks the crucial information mentioned above! So I have to step up my own game, too.

This report *also* includes detailed information, though, in particular that Torsten fixed this issue a long time ago, which suggests to me that you are somehow still stuck with the 1.x train (run `git version` to find out).

Ciao, Johannes

← back to recent threads