diff options
| author | 2026-05-24 11:07:16 +0000 | |
|---|---|---|
| committer | 2026-05-24 11:09:59 +0000 | |
| commit | 36340918040627d93808c09dea8d9bd7b7457f82 (patch) | |
| tree | dab5fa0edbf2f2bf315d1fda73c0f7ac5c8fc6d9 /internal/testgit | |
| parent | internal/testgit: Add Algorithm method (diff) | |
| signature | No signature | |
object/id: Rename algorithm to object format
Diffstat (limited to 'internal/testgit')
| -rw-r--r-- | internal/testgit/object.go | 2 | ||||
| -rw-r--r-- | internal/testgit/repo.go | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/internal/testgit/object.go b/internal/testgit/object.go index 566c8b82..fe4b329e 100644 --- a/internal/testgit/object.go +++ b/internal/testgit/object.go @@ -19,7 +19,7 @@ func (repo *Repo) HashObject(tb testing.TB, ty typ.Type, body io.Reader) id.Obje tb.Fatalf("hash-object: %v", hex) } - id, err := id.FromHex(repo.algo, string(hex)) + id, err := id.FromHex(repo.objectFormat, string(hex)) if err != nil { tb.Fatalf("parse git hash-object output %q: %v", hex, err) } diff --git a/internal/testgit/repo.go b/internal/testgit/repo.go index fcb6ae90..54330906 100644 --- a/internal/testgit/repo.go +++ b/internal/testgit/repo.go @@ -9,13 +9,13 @@ import ( ) type Repo struct { - path string - algo id.Algorithm - env []string + path string + objectFormat id.ObjectFormat + env []string } -func (repo *Repo) Algorithm() id.Algorithm { - return repo.algo +func (repo *Repo) ObjectFormat() id.ObjectFormat { + return repo.objectFormat } func (repo *Repo) Command( @@ -32,15 +32,15 @@ func (repo *Repo) Command( } type RepoOptions struct { - ObjectFormat id.Algorithm + ObjectFormat id.ObjectFormat } func NewRepo(tb testing.TB, opts RepoOptions) (*Repo, error) { tb.Helper() repo := &Repo{ - path: tb.TempDir(), - algo: opts.ObjectFormat, + path: tb.TempDir(), + objectFormat: opts.ObjectFormat, env: append(os.Environ(), "GIT_CONFIG_GLOBAL=/dev/null", "GIT_CONFIG_SYSTEM=/dev/null", @@ -53,5 +53,5 @@ func NewRepo(tb testing.TB, opts RepoOptions) (*Repo, error) { ), } - return repo, repo.Command(tb, "git", "init", "--object-format="+repo.algo.String(), "--", repo.path).Run() + return repo, repo.Command(tb, "git", "init", "--object-format="+repo.objectFormat.String(), "--", repo.path).Run() } |
