Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lxjhk
Copy link

@lxjhk lxjhk commented Dec 30, 2019

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

gitleaks/gitleaks#124 (comment)
#457 (comment)

Changes Made

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant