shithub: furgit

ref: c8dd7d3b44c93a664dddc0c4619d336c6e13d2a8
dir: /internal/testgit/repo_remove_loose_object.go/

View raw version
package testgit

import (
	"fmt"
	"testing"

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

// RemoveLooseObject removes one loose object file from the repository.
func (testRepo *TestRepo) RemoveLooseObject(tb testing.TB, id objectid.ObjectID) {
	tb.Helper()

	root := testRepo.OpenObjectsRoot(tb)
	hex := id.String()
	path := fmt.Sprintf("%s/%s", hex[:2], hex[2:])

	err := root.Remove(path)
	if err != nil {
		tb.Fatalf("remove loose object %s: %v", id, err)
	}
}