From: Dan Moseley <Dan.Moseley@microsoft.com>
To: "tboegi@web.de" <tboegi@web.de>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: RE: [EXTERNAL] [PATCH v2 1/1] git mv foo FOO ; git mv foo bar gave an assert
Date: Mon, 1 Mar 2021 20:23:13 +0000 [thread overview]
Message-ID: <BYAPR21MB1158CDD04067369BB367474CE09A9@BYAPR21MB1158.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20210301170425.12154-1-tboegi@web.de>
> From: Torsten Bögershausen <tboegi@web.de>
>
> The following sequence, on a case-insensitive file system,
> (strictly speeking with core.ignorecase=true)
> leads to an assertion, 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".
>
> Reported-By: Dan Moseley <Dan.Moseley@microsoft.com>
>
> This fixes
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgit-for-windows%2Fgit%2Fissues%2F2920&data=04%7C01%7CDan.Moseley%40microsoft.com%7Cb659ba5925c543bcc3e708d8dcd41268%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637502150683596627%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2BLjQf5NooTUgOKbsyn10XCFIAgMw9v%2BKlhx8kDD6%2BIg%3D&reserved=0
>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
> builtin/mv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/mv.c b/builtin/mv.c
> index 7dac714af9..3fccdcb645 100644
> --- a/builtin/mv.c
> +++ b/builtin/mv.c
> @@ -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");
> --
> 2.30.0.155.g66e871b664
>
Thank you Thorsten. This makes sense to me. Do you want to add a test?
I believe this is what I had in my original patch, that worked pretty well:
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 63d5f41a12..5c7fee9bd8 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -152,6 +152,14 @@ test_expect_success \
'move into "."' \
'git mv path1/path2/ .'
+test_expect_success \
+ 'fail to move file already in index under different cased name' \
+ 'echo 1 > foo &&
+ git add foo &&
+ git commit -m add_file -- foo &&
+ git mv foo FOO &&
+ test_expect_code 128 git mv foo BAR'
+
test_expect_success "Michael Cassar's test case" '
rm -fr .git papers partA &&
git init &&
--
2.25.1
next prev parent reply other threads:[~2021-03-01 20:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BYAPR21MB1158F64E1141453F7D00B46CE0D89@BYAPR21MB1158.namprd21.prod.outlook.com>
[not found] ` <BYAPR21MB11585FFD46DEE7AD4EEEFEABE0D89@BYAPR21MB1158.namprd21.prod.outlook.com>
2020-12-29 2:06 ` [PATCH] git-mv: fix git mv bug with case insensitive fs Dan Moseley
2020-12-31 7:13 ` Torsten Bögershausen
2021-01-06 4:05 ` Junio C Hamano
2021-01-06 10:53 ` [PATCH/RFC v1 1/1] git mv foo FOO ; git mv foo bar gave an assert tboegi
2021-01-06 23:51 ` Junio C Hamano
2021-03-01 17:05 ` [PATCH v2 " tboegi
2021-03-01 19:21 ` Junio C Hamano
2021-03-01 19:36 ` Chris Torek
2021-03-01 21:53 ` Junio C Hamano
[not found] ` <20210301170425.12154-1-tboegi@web.de>
2021-03-01 20:23 ` Dan Moseley [this message]
2021-03-01 21:47 ` [EXTERNAL] " Junio C Hamano
2021-03-01 21:41 ` [PATCH v3 " tboegi
2021-03-01 23:59 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BYAPR21MB1158CDD04067369BB367474CE09A9@BYAPR21MB1158.namprd21.prod.outlook.com \
--to=dan.moseley@microsoft.com \
--cc=git@vger.kernel.org \
--cc=tboegi@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).