From fa3ebe770eaf3388bc48bdceba6affb5bc6d5357 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 7 Jun 2026 07:44:38 +0000 Subject: internal/testgit: Add show and fsck --- internal/testgit/show.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 internal/testgit/show.go (limited to 'internal/testgit/show.go') diff --git a/internal/testgit/show.go b/internal/testgit/show.go new file mode 100644 index 00000000..31acb9d3 --- /dev/null +++ b/internal/testgit/show.go @@ -0,0 +1,20 @@ +package testgit + +import ( + "fmt" + "testing" + + "lindenii.org/go/furgit/object/id" +) + +// ShowFormat returns git-show output for one pretty format. +func (repo *Repo) ShowFormat(tb testing.TB, oid id.ObjectID, format string) ([]byte, error) { + tb.Helper() + + stdout, err := repo.Run(tb, nil, "git", "show", "--no-patch", "--no-color", "--format="+format, oid.String()) + if err != nil { + return nil, fmt.Errorf("show --format=%q %s: %w", format, oid, err) + } + + return stdout, nil +} -- cgit v1.3.1-10-gc9f91