aboutsummaryrefslogtreecommitdiff
path: root/internal/testgit/repo_mktree.go
blob: 34e6388dc4f824cc244f5f0c83564de2dce023f6 (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/objectid"
)

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