shithub: furgit

ref: 79c40dcb08f0d512bd6d75d5e2acd3ddceec4530
dir: /internal/testgit/repo_mktree.go/

View raw version
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
}