MCPcopy Create free account
hub / github.com/containers/fetchit / getTreeFromHash

Function getTreeFromHash

pkg/engine/apply.go:135–156  ·  view source on GitHub ↗
(directory string, hash plumbing.Hash)

Source from the content-addressed store, hash-verified

133}
134
135func getTreeFromHash(directory string, hash plumbing.Hash) (*object.Tree, error) {
136 if hash.IsZero() {
137 return &object.Tree{}, nil
138 }
139
140 repo, err := git.PlainOpen(directory)
141 if err != nil {
142 return nil, utils.WrapErr(err, "Error opening repository: %s", directory)
143 }
144
145 commit, err := repo.CommitObject(hash)
146 if err != nil {
147 return nil, utils.WrapErr(err, "Error getting commit at hash %s from repo %s", hash, directory)
148 }
149
150 tree, err := commit.Tree()
151 if err != nil {
152 return nil, utils.WrapErr(err, "Error getting tree from commit at hash %s from repo %s", hash, directory)
153 }
154
155 return tree, nil
156}
157
158func getFilteredChangeMap(
159 directory string,

Callers 1

ApplyMethod · 0.85

Calls 1

WrapErrFunction · 0.92

Tested by

no test coverage detected