Skip to content

Commit

Permalink
fix: Fix race condition in concurrent parsing of externals
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Aug 9, 2023
1 parent 552d255 commit 4fc3203
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/chezmoi/sourcestate.go
Expand Up @@ -1280,6 +1280,9 @@ func (s *SourceState) TargetRelPaths() []RelPath {

// TemplateData returns a copy of s's template data.
func (s *SourceState) TemplateData() map[string]any {
s.Lock()
defer s.Unlock()

if s.templateData == nil {
s.templateData = make(map[string]any)
if s.defaultTemplateDataFunc != nil {
Expand Down

0 comments on commit 4fc3203

Please sign in to comment.