go-git icon indicating copy to clipboard operation
go-git copied to clipboard

Made idxfile safe for concurrent access so that users can run blame concurrently

Open lxjhk opened this issue 4 years ago • 0 comments

Signed-off-by: lxjhk [email protected]

Issue Addressed

Git blame takes a long time to run. A natural optimization is to run git blame on multiple files concurrently. However, the existing implementation for idxfile uses Go's standard map data type which will cause "concurrent read and write to a map" run-time panic because of race conditions.

Ref Issues

https://github.com/zricethezav/gitleaks/issues/124#issue-373459034 https://github.com/src-d/go-git/issues/457#issue-239967754

Changes Made

Changed map[int64]plumbing.Hash to sync.Map

lxjhk avatar Dec 30 '19 09:12 lxjhk