Skip to content

fix: resolve data race in TestRepackInterval#208

Merged
alecthomas merged 1 commit intomainfrom
fix/repack-test-data-race
Mar 21, 2026
Merged

fix: resolve data race in TestRepackInterval#208
alecthomas merged 1 commit intomainfrom
fix/repack-test-data-race

Conversation

@worstell
Copy link
Contributor

Problem

TestRepackInterval/Enabled has a data race between assert.NotZero (which uses repr to deep-reflect over the entire *git.Strategy struct) and HTTP transport goroutines spawned during git.New.

Fix

Replace assert.NotZero(t, s) with assert.True(t, s != nil) — the test only needs to verify a non-nil return, so deep reflection is unnecessary.

assert.NotZero uses repr to deep-reflect over the entire Strategy struct,
which races with HTTP transport goroutines spawned during git.New. Replace
with a simple nil check since the test only needs to verify non-nil return.

Amp-Thread-ID: https://ampcode.com/threads/T-019d0be9-cfd7-72bf-9bbb-4a70965214f6
Co-authored-by: Amp <amp@ampcode.com>
@worstell worstell requested a review from a team as a code owner March 20, 2026 15:48
@worstell worstell requested review from alecthomas and removed request for a team March 20, 2026 15:48
@worstell worstell changed the title fix(git): resolve data race in TestRepackInterval fix: resolve data race in TestRepackInterval Mar 20, 2026
@alecthomas alecthomas merged commit 80643b3 into main Mar 21, 2026
8 checks passed
@alecthomas alecthomas deleted the fix/repack-test-data-race branch March 21, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants