MCPcopy Index your code
hub / github.com/git-bug/git-bug / readRemote

Function readRemote

entity/dag/entity.go:73–81  ·  view source on GitHub ↗

readRemote will read and decode a stored remote Entity from a repository

(def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, id entity.Id)

Source from the content-addressed store, hash-verified

71
72// readRemote will read and decode a stored remote Entity from a repository
73func readRemote[EntityT entity.Interface](def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, id entity.Id) (EntityT, error) {
74 if err := id.Validate(); err != nil {
75 return *new(EntityT), errors.Wrap(err, "invalid id")
76 }
77
78 ref := fmt.Sprintf("refs/remotes/%s/%s/%s", def.Namespace, remote, id.String())
79
80 return read[EntityT](def, wrapper, repo, resolvers, ref)
81}
82
83// read fetch from git and decode an Entity at an arbitrary git reference.
84func read[EntityT entity.Interface](def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, ref string) (EntityT, error) {

Callers 2

TestRemoveFunction · 0.85
TestRemoveAllFunction · 0.85

Calls 2

ValidateMethod · 0.65
StringMethod · 0.65

Tested by 2

TestRemoveFunction · 0.68
TestRemoveAllFunction · 0.68