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