]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git mv foo FOO ; git mv foo bar gave an assert
authorTorsten Bögershausen <tboegi@web.de>
Mon, 1 Mar 2021 21:41:42 +0000 (22:41 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 4 Mar 2021 01:07:12 +0000 (17:07 -0800)
The following sequence, on a case-insensitive file system,
(strictly speeking with core.ignorecase=true)
leads to an assertion failure and leaves .git/index.lock behind.

git init
echo foo >foo
git add foo
git mv foo FOO
git mv foo bar

This regression was introduced in Commit 9b906af657,
"git-mv: improve error message for conflicted file"

The bugfix is to change the "file exist case-insensitive in the index"
into the correct "file exist (case-sensitive) in the index".

This avoids the "assert" later in the code and keeps setting up the
"ce" pointer for ce_stage(ce) done in the next else if.

This fixes
https://github.com/git-for-windows/git/issues/2920

Reported-By: Dan Moseley <Dan.Moseley@microsoft.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mv.c

index 7dac714af908789c675a158cf44067771dd62ad2..3fccdcb64522b4a102bd1aeedae972debb9e1aca 100644 (file)
@@ -221,7 +221,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                }
                                argc += last - first;
                        }
-               } else if (!(ce = cache_file_exists(src, length, ignore_case))) {
+               } else if (!(ce = cache_file_exists(src, length, 0))) {
                        bad = _("not under version control");
                } else if (ce_stage(ce)) {
                        bad = _("conflicted");