GitPython icon indicating copy to clipboard operation
GitPython copied to clipboard

Git index version 3 support

Open sebastianst opened this issue 1 year ago • 5 comments

Using git python to add files to an index fails at an index head assertion if the local repo is being otherwise worked on with git 2.46.0: https://github.com/gitpython-developers/GitPython/blob/cfadd9e5edb8571c2c15878c8eeca91f15a69040/git/index/fun.py#L209-L210

Is it planned to add support for version 3 soon?

I couldn't find any ticket tracking this, so apologies if this is a duplicate.

sebastianst avatar Sep 06 '24 14:09 sebastianst

There is no plan to add support for extended index flag in V3, even though it would probably be quite easy to add if someone wanted to contribute support for it.

Generally, I probably wouldn't trust the index implementation as it is here and if possible, repo.git might be able to do the same with a decent amount of convenience.

Byron avatar Sep 06 '24 17:09 Byron

For the record, the workaround is to set:

git config --global feature.manyFiles false

and clone the repo again (or use -c feature.manyFiles=false when cloning it).

mgorny avatar Nov 04 '24 13:11 mgorny

Made a PR to make errors from using an unsupported version a bit easier to debug: https://github.com/gitpython-developers/GitPython/pull/2055

tombedor avatar Jun 17 '25 16:06 tombedor

It's a bit sad that the custom index implementation is half-baked only, and a little wonder that people can use it at all. In retrospect, it would have been better to only use Git for index manipulation. Maybe it's possible to workaround with repo.git as well.

Byron avatar Jun 18 '25 02:06 Byron

thank you, index v3 support will help fix a crash for us.

misrasaurabh1 avatar Nov 15 '25 01:11 misrasaurabh1