aboutsummaryrefslogtreecommitdiff
path: root/internal/testgit/repo_mktree.go
blob: bd2785e24efd903cb94e6d76ff3e8a21beca07c0 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package testgit

import (
	"testing"

	"codeberg.org/lindenii/furgit/oid"
)

// Mktree creates a tree from textual mktree input and returns its ID.
func (repo *TestRepo) Mktree(tb testing.TB, input string) oid.ObjectID {
	tb.Helper()
	hex := repo.RunInput(tb, []byte(input), "mktree")
	id, err := oid.ParseHex(repo.algo, hex)
	if err != nil {
		tb.Fatalf("parse mktree output %q: %v", hex, err)
	}
	return id
}