Skip to content

Commit

Permalink
Need to hold the lock during Version
Browse files Browse the repository at this point in the history
Signed-off-by: John Belamaric <[email protected]>
  • Loading branch information
johnbelamaric committed Nov 16, 2023
1 parent c9cd488 commit eeefc71
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions porch/pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ func (r *gitRepository) Close() error {
func (r *gitRepository) Version(ctx context.Context) (string, error) {
ctx, span := tracer.Start(ctx, "gitRepository::Version", trace.WithAttributes())
defer span.End()
r.mutex.Lock()
defer r.mutex.Unlock()

if err := r.fetchRemoteRepository(ctx); err != nil {
return "", err
Expand Down

0 comments on commit eeefc71

Please sign in to comment.