diff options
Diffstat (limited to 'internal/testgit/show.go')
| -rw-r--r-- | internal/testgit/show.go | 20 |
1 files changed, 20 insertions, 0 deletions
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 +} |
