diff --git a/submitqueue/extension/changeprovider/git/provider_test.go b/submitqueue/extension/changeprovider/git/provider_test.go index 021222862..33b78299f 100644 --- a/submitqueue/extension/changeprovider/git/provider_test.go +++ b/submitqueue/extension/changeprovider/git/provider_test.go @@ -62,18 +62,25 @@ func newFixture(t *testing.T) *fixture { work: filepath.Join(root, "work"), } + // Every repository in this fixture disables auto-maintenance so cleanup cannot race a background repack. f.run("", "init", "--bare", "-b", "main", f.remote) + f.run(f.remote, "config", "maintenance.auto", "false") f.run("", "clone", f.remote, f.work) f.run(f.work, "config", "user.name", "Test") f.run(f.work, "config", "user.email", "test@example.invalid") + f.run(f.work, "config", "maintenance.auto", "false") f.write("seed.txt", "seed\n") f.run(f.work, "add", ".") f.run(f.work, "commit", "-m", "seed") f.run(f.work, "push", "origin", "main") + copyPath := filepath.Join(root, "copy.git") + f.run("", "init", "--bare", "-b", "main", copyPath) + f.run(copyPath, "config", "maintenance.auto", "false") + repo, err := gitrepo.NewRepo(gitrepo.RepoConfig{ Git: git, - Path: filepath.Join(root, "copy.git"), + Path: copyPath, RemoteURL: f.remote, Target: "main", }) @@ -300,6 +307,7 @@ func TestGet_UnrelatedHistoryIsAnError(t *testing.T) { f.run("", "clone", f.remote, orphan) f.run(orphan, "config", "user.name", "Test") f.run(orphan, "config", "user.email", "test@example.invalid") + f.run(orphan, "config", "maintenance.auto", "false") f.run(orphan, "checkout", "--orphan", "feature/orphan") f.run(orphan, "rm", "-rf", ".") require.NoError(t, os.WriteFile(filepath.Join(orphan, "alone.txt"), []byte("alone\n"), 0o644))