Search code examples
gitgit-svn

How to recover from "unordered stage entries in index" error in git


I've just upgraded my git from 2.0.5 to 2.3.6, and I'm now unable to run git svn fetch in one of my repositories:

$ git svn fetch
fatal: unordered stage entries in index
write-tree: command returned error: 128

git status shows a few untracked files but is otherwise clean.

I located the change where this check was introduced, with the summary "read_index_from(): catch out of order entries when reading an index file" (first appearing in 2.2.0), and some mailing list discussion of it that says among other things:

I think we have been discussing how to protect broken index file left by tools other people wrote, so I wouldn't be so surprised if our current toolset does not let you recreate certain breakages ;-)

I don't recall running any other tools on this repo; it doesn't do much day-to-day other than a long series of git svn fetches. (But it's been around for a couple of years so who knows.)

At any rate, what can I do to recover from this situation? I tried to locate a path with multiple index entries like this but got no results:

$ git ls-files -s | cut -f 2-100 | sort | uniq -c | grep -v '^[ \t]*1 '

Solution

  • what can I do to recover from this situation?

    https://stackoverflow.com/a/27481661/3161761

    something like this

    rm .git/index
    git add -A