From e083d4dc1f455bd57b2f9d473fb44f5ee5ccbbe3 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 6 Jun 2026 16:31:02 +0000 Subject: internal/testgit: hash-object and command --- internal/testgit/object.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'internal/testgit/object.go') diff --git a/internal/testgit/object.go b/internal/testgit/object.go index a46ef02b..6f1a2dd8 100644 --- a/internal/testgit/object.go +++ b/internal/testgit/object.go @@ -12,16 +12,15 @@ import ( // and returns its object ID. func (repo *Repo) HashObject(tb testing.TB, ty typ.Type, body io.Reader) id.ObjectID { tb.Helper() - cmd := repo.Command(tb, "git", "hash-object", "-t", ty.Name(), "-w", "--stdin", "--literally") - hex, err := cmd.CombinedOutput() + stdout, err := repo.Run(tb, body, "git", "hash-object", "-t", ty.Name(), "-w", "--stdin", "--literally") if err != nil { - tb.Fatalf("hash-object: %v", hex) + tb.Fatalf("hash-object: %v", err) } - id, err := repo.objectFormat.FromString(string(hex)) + id, err := repo.objectFormat.FromString(string(stdout)) if err != nil { - tb.Fatalf("parse git hash-object output %q: %v", hex, err) + tb.Fatalf("parse git hash-object output %q: %v", string(stdout), err) } return id -- cgit v1.3.1-10-gc9f91