Re: Git config "ignorecase = true" has issues
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- May 21, 2019, 02:31 UTC
- Message-ID
- <20190521023106.3sfrapksxg6xjtdg@tb-raspi4>
- In-Reply-To
- <b75455b6-139a-aa6c-c7f6-7c9330e2ac6f@kdbg.org>
On Sat, May 18, 2019 at 06:38:39PM +0200, Johannes Sixt wrote:
Show 9 quoted lines
> Am 18.05.19 um 14:58 schrieb Ax Da: > > You can rename files like this: > > git mv File.txt file.txt > > On a case-insensitive, case-preserving filesystem, a case-only rename > operation is better performed in two steps that do not just change the case: > > git mv File.txt file.txtx > git mv file.txtx file.txt
Is this still needed in latest versions of Git, please see below ? A quick test shows that both the file is renamed and the index is updated:
user@mac:~/projects/git/git.pu> git mv Makefile MAKEFILE user@mac:~/projects/git/git.pu> ls -l MAKEFILE -rw-r--r-- 1 tb staff 100301 Apr 17 16:53 MAKEFILE
user@mac:~/projects/git/git.pu> git status HEAD detached at git.git/pu Changes to be committed: (use "git reset HEAD <file>..." to unstage)
renamed: Makefile -> MAKEFILE
commit baa37bff9a845471754d3f47957d58a6ccc30058 Author: David Turner <dturner@twitter.com> Date: Thu May 8 10:23:34 2014 -0700
mv: allow renaming to fix case on case insensitive filesystems
"git mv hello.txt Hello.txt" on a case insensitive filesystem
always triggers "destination already exists" error, because these
two names refer to the same path from the filesystem's point of
view, and requires the user to give "--force" when correcting the
case of the path recorded in the index and in the next commit.Detect this case and allow it without requiring "--force".
Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>[snip]