Bug: Case-insensitive filesystems can cause merge and checkout problems
- From
David Turner <dturner@twopensource.com>
- Date
- Apr 29, 2014, 19:02 UTC
- Message-ID
- <CAE+yK_m_bPt2pS6MQOrpvVDuLAJf8NFxYOgM8i98tU6-gLcTDw@mail.gmail.com>
By default, git sets core.ignorecase=true when git init or git clone is run on a machine with a case-insensitive filesystem. Here's a test-case for some problems that this causes:
git checkout master touch TestCase git add TestCase git commit -m 'add TestCase' git checkout -b with-camel touch foo git add foo git commit -m 'intervening commit' git checkout master git rm TestCase touch testcase git add testcase git commit -m 'rename to testcase' git checkout with-camel git merge master -m 'merge'
One would expect a clean working copy at this point, but in fact, the file 'testcase' will be deleted.
With core.ignorecase=false, we get a different failure. The
penultimate command fails with:
$ git checkout with-camel
error: The following untracked working tree files would be overwritten
by checkout:
TestCase
Please move or remove them before you can switch branches.
AbortingOf course, there is no untracked working tree file by that name; there is a tracked working tree file named testcase (all-lowercase).