1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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, "--end-of-options", oid.String())
if err != nil {
return nil, fmt.Errorf("show --format=%q %s: %w", format, oid, err)
}
return stdout, nil
}
|