ref: 304559e6a539cb60e97c429d56a32991d1c68bc1
parent: 680d30bd77c4793fe5c1eaa05ad5217a2faee7c0
author: Runxi Yu <me@runxiyu.org>
date: Sat Feb 21 07:31:06 EST 2026
testgit: Remove old new-repo helpers and use NewRepo with good RepoOptions
--- a/internal/testgit/repo_new.go
+++ b/internal/testgit/repo_new.go
@@ -9,6 +9,8 @@
// RepoOptions controls git-init options for test repositories.
type RepoOptions struct {+ // ObjectFormat is the object ID algorithm used for repository objects.
+ ObjectFormat objectid.Algorithm
// Bare selects whether the repository is initialized as bare.
Bare bool
// RefFormat selects the git ref storage format (for example "files" or
@@ -16,21 +18,10 @@
RefFormat string
}
-// NewBareRepo creates a temporary bare repository initialized with the requested algorithm.
-func NewBareRepo(tb testing.TB, algo objectid.Algorithm) *TestRepo {- tb.Helper()
- return NewRepo(tb, algo, RepoOptions{Bare: true})-}
-
-// NewWorkRepo creates a temporary non-bare repository initialized with the requested algorithm.
-func NewWorkRepo(tb testing.TB, algo objectid.Algorithm) *TestRepo {- tb.Helper()
- return NewRepo(tb, algo, RepoOptions{Bare: false})-}
-
// NewRepo creates a temporary repository initialized with the requested options.
-func NewRepo(tb testing.TB, algo objectid.Algorithm, opts RepoOptions) *TestRepo {+func NewRepo(tb testing.TB, opts RepoOptions) *TestRepo {tb.Helper()
+ algo := opts.ObjectFormat
if algo.Size() == 0 { tb.Fatalf("invalid algorithm: %v", algo)}
--
⑨