Re: Files 'Test.txt' and 'test.txt' are different in Git database, but are the same on Windows file system issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-08-12 at 19:58:55, Viktor Hozhyi wrote:
> On Wed, Aug 12, 2020 at 10:56 PM Viktor <viktor.hozhyi@xxxxxxxxx> wrote:
> >
> > Hi,
> >
> >
> >
> > I’m not sure whether this behavior is on Windows only, so it’s up to you guys.

This behavior happens on any case-insensitive file system.  That means
on Windows when the directory is not marked case-sensitive, on macOS if
the file system is case-insensitive, and also in some other scenarios
(e.g., case-insensitive JFS on Linux).

Both Windows 10 and macOS are capable of using case-sensitive file
systems or directories, so this is not exclusive to any one operating
system.

> > Repro steps:
> >
> > 1.         Having branch (let say) develop with empty working tree and empty repository – create 2 more branches (‘foo’ and ‘bar’)
> >
> > 2.         Commit file ‘Test.txt’ with content ‘Test’ to ‘foo’ branch
> >
> > 3.         Switch to ‘bar’  branch and commit file ‘test.txt’ with content ‘test’ (pay attention lower-case)
> >
> > 4.         Merge ‘foo’ to develop
> >
> > 5.         Merge ‘bar’ to develop
> >
> > After it when you switch to develop – you always will have ‘local changes’. You can perform stash, hard reset, commit – you always will have local changes (and many following errors on other git operations due to local changes).
> >
> > Reason – we have different files in Git DB (‘Test.txt’ and ‘test.txt’), but when git restores them onto Windows file system – it just will rewrite 1 file with another, because for Windows file system – it is 2 equal names.

Git was designed for Unix systems where files are case sensitive.  This
is the only behavior that produces correct results for all languages and
locales; it's impossible to correctly do locale-insensitive case
folding.  That Git is case sensitive is very much by design.

If you're seeing this problem, you can do something like this:

  git mv --cached Test.txt test.txt

For a directory, you'd need to do this:

  git mv Test temp
  git mv temp test

That will move Test.txt into test.txt, which will solve your problem by
creating exactly one file.  If you prefer, you can do it the other way
as well.

That's the only possible solution if you're using a case-insensitive
file system; the other choice is to use the Windows 10 tools to make the
repository and its child directories case sensitive.
-- 
brian m. carlson: Houston, Texas, US

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux