New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git mv fails (assertion failure) #2920
Comments
Please work on providing a Minimal, Complete & Verifiable Example. It will dramatically increase your chances to receive helpful assistance. What you provided is neither minimal, nor complete, as you have not made your repository publicly accessible. |
Having said that...
Please note that the Git index is not case-insensitive. So while you may access the directory on disk via git mv MFW2/application/phaseCalc_IQ_Xiong.hpp PC_phaseTest/ |
I will assume that the suggested |
In case it's helpful, here's a trivial repro as I hit this crash also:
At this point git crashes and leaves .git/index.lock behind. This is on Windows 10 20H2. |
Quick clarification: Have you been able to test the repo on WSL/WSL2 or Linux (i.e. did you check if it was an upstream Git problem or special to Git for Windows)? |
No need to test WSL or whatever, as far as I can see.
|
@tboegi do you plan to contribute that fix? |
@danmosemsft : |
Trying
I assume it repros on Linux if it is possible to have a case insensitive file system. |
I'm happy to submit a fix, but I have a question about how to test it. I was expecting the exit code when the assert happens to be 128+SIGABRT = 134, however it is 3:
In my test, I have My knowledge of signals/shell is limited. What am I missing? |
Ah, I see this is MSVCRT default behavior to I will just do |
It means that we probably don't test assertions in the test suite. Typically, Besides, there is a trend to remove |
My observation was that an assert within |
I wonder how one would set up a test case that runs into a situation expected never to happen (and only defensively guarded via an
|
Presumably any test could in theory hit an assert, just as it could hit a segfault. It might be configuration specific, non deterministic, etc. |
|
Seems like it's being used to test cases where git commands are supposed to fail for bad input? eg
README says the purpose of test_must_fail is to verify a git command fails without missing segv's as |
Whoops, I confused Having said that, An |
Hi @dscho, isn't that a catch 22 problem. An assert without a test only has a vain hope of triggering, so the 'developer' is left in a bit of no-man's land where production (release) code will wander off into some seg fault because the check is skipped, while the maintaining dev does want to know how to try and trigger the fault. Not sure there's an easy solution. Maybe those tests could have a 'DEVELOPER' pre-req? Just a thought. |
No. I fear you're mistaking All you're supposed to do with that construct is verify invariants, things you (the developer) take for granted, e.g. that a given array is sorted ( If you need to add a regression test to verify that your invariant testing is sound, you need to think about your life choices :-)
If you're relying on Again, this is a function intended to verify invariants while developing the code in question (or while debugging it). That's all |
So, by that argument, this assert never triggered .... which is why it's a catch 22 at this level. |
Why are we even talking about this anymore? The fact that an |
This very assert should not trigger at all - a patch has been send upstream. |
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 9b906af, "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 git-for-windows#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>
Setup
$ cmd.exe /c ver
Microsoft Windows [Version 10.0.19041.630]
type "C:\Program Files\Git\etc\install-options.txt"
Editor Option: Nano
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Core
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Details
File I am trying to MV is committed.
Target directory is under source control and contains committed files.
git deleted source file but failed to add target.
c:\git_CAP\repo_MFW2>git mv mfw2/application/phaseCalc_IQ_Xiong.hpp PC_phaseTest/phaseCalc_IQ_Xiong.hpp
Assertion failed: pos >= 0, file builtin/mv.c, line 295
c:\git_CAP\repo_MFW2>git status mfw2/application/phaseCalc_IQ_Xiong.hpp
On branch master
nothing to commit, working tree clean
c:\git_CAP\repo_MFW2>git status PC_phaseTest
On branch master
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git restore ..." to discard changes in working directory)
modified: PC_phaseTest/InitialWorkingOutput.txt
modified: PC_phaseTest/PC_phaseTest.cpp
Untracked files:
(use "git add ..." to include in what will be committed)
PC_phaseTest/phaseCalc_IQ_Xiong.hpp
no changes added to commit (use "git add" and/or "git commit -a")
c:\git_CAP\repo_MFW2>git status
On branch master
Changes not staged for commit:
(use "git add/rm ..." to update what will be committed)
(use "git restore ..." to discard changes in working directory)
modified: MFW2/application/phaseCalc_IQ_Dave.cpp
deleted: MFW2/application/phaseCalc_IQ_Xiong.hpp
modified: PC_phaseTest/InitialWorkingOutput.txt
Untracked files:
(use "git add ..." to include in what will be committed)
PC_phaseTest/phaseCalc_IQ_Xiong.hpp
no changes added to commit (use "git add" and/or "git commit -a")
The text was updated successfully, but these errors were encountered: