ref: b3b2d5057a55baf88cbaaa31234edd3fe5d30e7f
dir: /internal/testgit/repo_make_single_file_tree.go/
package testgit
import (
"fmt"
"testing"
"codeberg.org/lindenii/furgit/oid"
)
// MakeSingleFileTree writes one blob and one tree entry for it and returns (blobID, treeID).
func (repo *TestRepo) MakeSingleFileTree(tb testing.TB, fileName string, fileContent []byte) (oid.ObjectID, oid.ObjectID) {
tb.Helper()
blobID := repo.HashObject(tb, "blob", fileContent)
treeInput := fmt.Sprintf("100644 blob %s\t%s\n", blobID.String(), fileName)
treeID := repo.Mktree(tb, treeInput)
return blobID, treeID
}