atom/git-utils

git-utils crashes when opening a repository using index version 4

niw opened this issue · 9 comments

niw commented

Due to current submodule libgit2 which doesn't support index version 4 and may crash because of tree_iterator implementation issue, git-utils may crash when opening such git repository.

A minimum fix is, at least, merge libgit2/libgit2@4fea9cf commit.

A real fix is ask libgit2 to support index version 4 (See https://github.com/libgit2/libgit2/blob/master/src/index.c#L2343-L2345)

Repro steps:

  1. Create a git repository and commit a file.
  2. Run git update-index --index-version=4 to update index version to 4.
  3. Run git.open("path-to-git") on node

Expected behavior:
Open git repository

Actual behavior:
Crash

+1 I would like to see this get some traction as this issue makes it hard to use Atom on any such repo.

niw commented

I think it's better to hold this until libgit2/libgit2#3837 gets merged, which is a real fix for this issue.

Above PR has been merged.

xcv58 commented

Any update? The libgit2 already released new version to fix this.

niw commented

libgit2/libgit2#3837 is merged on libgit2/libgit2 and on its master, however, it's not released yet.
I think it might be better to wait its release, technically we can use its master tho.

niw commented

Just in case I updated #71 to use 0.24.1, which is their latest release (but that doesn't include libgit2/libgit2#3837)

niw commented

I updated again #71 to use 0.24.2.
However, seems like any libgit2 0.24.x may not include libgit2/libgit2#3837 that addresses index version 4 issue. So, probably #71 may not a fix for this issue, however, still #71 that upgrades libgit2 to 0.24.x might be useful because it can solve #73 as @tgandrews mentioned.

Updated to 0.24.3 which stops the crashing but effectively disables git integration when using with a clone that has a v4 index.

niw commented

As I commented before on this thread, libgit2/libgit2#3837 is the real solution for this issue, which is merged in libgit2 master and available as a part of v0.25.0-rc1. Thus, once libgit2/libgit2 v0.25.0 is released, then bump the version, then we can solve this issue also atom/atom#11225.