-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 error invalid data in index
with index.skipHash config
#11857
Comments
Hm, I can't reproduce with those steps. Which version of git are you using? Can you show the output of |
hm, ok, let me look into it deeper and get all that info and see if it is more niche.., |
Cannot reproduce on my machine. With rust 1.64 it still compiles. Cargo is installed via rustup on macOS with git 2.39.2. |
I encountered the same issue for helix although I am not in a nested repository. I tested with the latest commit on helix helix-editor/helix@583f6a1. Maybe it's a different issue?
|
ok, i figured it out. this seems to actually indeed be the gitconfig. essentially, my gitconfig had the specific option in this case that causes this failure is
note that my git version is 2.40.0, but i'm not sure if this is relevant when cargo utilises libgit(?). an easy reproducer via dockerfile:
|
so, basically it's git that breaks this. but i will note that i have had these options set for a really long time. so, either git 2.40 changed some behaviour here, or cargo changed what it expects. my guess is the former, but i'm not sure if there's anything to handle here or the resolution is "don't use fancy git features and expect it to work" |
if i change only to alpine:3.17 with git 2.38.4, the failure goes away. almost for sure git then.. |
i think the 'earlier than 2.40' here implies they made a breaking change in 2.40. since cargo is using libgit, it has not prepared to handle the error yet, and fails with the above. makes sense for a start? |
Ah, I have this enabled too. After I disabled it and re-clone helix, then |
it's to do with the current 'state'. the moment you enable it, some hashes will be in that intentionally slightly broken state (because stuff gets regenerated)- you'd have to probably run some very specific commands to get it into a 'pure' state again that doesn't fail. cloning just starts fresh anew. (in very wishy-washy non-technical terms) |
Thanks for investigating! I have filed the upstream issue at libgit2/libgit2#6531 |
invalid data in index
with index.skipHash config
that's a very concise reproduction and explanation. thanks for investigating fully and filing it upstream. much appreciated! |
This reverts #31408, as it also sets the git config value `index.skipHash` which breaks cargo at the moment: rust-lang/cargo#11857 Contributors docs have been updated to recommend a shallow clone in #44158, which should alleviate some of the issues that manyFiles addresses.
This reverts #31408, as it also sets the git config value `index.skipHash` which breaks cargo at the moment: rust-lang/cargo#11857 Contributors docs have been updated to recommend a shallow clone in #44158, which should alleviate some of the issues that manyFiles addresses.
I had a repo I really didn't want to clone fresh. Running |
I just had this error and @tyehle fixed me |
The upstream issue libgit2/libgit2#6531 is resolved and |
We merged the new libgit2 in #14067 and this should be resolved |
Problem
before 1.68, this worked:
however, since 1.68, you now get:
of course, there is a workaround:
git init .
inside the source directoryhowever, i'm not sure if it's necessarily "correct" to break here, or why that is the case.
Steps
Possible Solution(s)
revert to old behaviour? i don't know the semantics for why this is the case now.
Notes
for background, the reason why the build is in an arbitrary git repository is because it is ran inside a ports tree (alpine linux aports in this case), and that is inside git.
as an aside (does not impact the above), GIT_CEILING_DIRECTORIES is set to prevent actual access to the repository metadata (versioning), but it does not affect this issue (whether it is set or not).
my question is- is there a reason cargo now 'requires' git to be clean/new or not exist to succeed and fails inside an existing repository?
Version
The text was updated successfully, but these errors were encountered: