Better error message for corrupt .git/index
See original GitHub issueA user received this error when they had a bad index.
Information {“Message”:"System.ArgumentOutOfRangeException: Non-negative number required.\r\nParameter name: dstOffset\r\n at System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)\r\n at GVFS.Virtualization.Projection.GitIndexProjection.GitIndexParser.ReadPath(GitIndexEntry indexEntryData, Int32 replaceIndex, Int32 byteCount)\r\n at GVFS.Virtualization.Projection.GitIndexProjection.GitIndexParser.ParseIndex(ITracer tracer, Stream indexStream, GitIndexEntry resuableParsedIndexEntry, Func2 entryAction)\r\n at GVFS.Virtualization.Projection.GitIndexProjection.GitIndexParser.RebuildProjection(ITracer tracer, Stream indexStream)\r\n at GVFS.Virtualization.Projection.GitIndexProjection.BuildProjectionFromPath(ITracer tracer, String indexPath)\r\n at GVFS.RepairJobs.RepairJob.TryParseIndex(String path, List
1 messages) in
Could it be more beneficial to run ‘git ls-files’ in and print out the error? Can we handle this better?
@kewillford @wilbaker @jamill @derrickstolee for everyone’s thoughts.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
I think in this specific case, even
gvfs repair
failed with the same error. @jeschu1 do you remember? I think we ended up deleting the.git/index
file and repairing after that.I think this is a good place to try/catch and throw an application exception (new
GVFSException
?) with a message to run thegvfs repair
which will fix the corrupt index.