MCPcopy Create free account
hub / github.com/ByteYellow/AgentProvenance / readRelativeFile

Function readRelativeFile

internal/provenance/diff.go:327–337  ·  view source on GitHub ↗
(root, rel string)

Source from the content-addressed store, hash-verified

325}
326
327func readRelativeFile(root, rel string) ([]byte, bool, error) {
328 path := filepath.Join(root, rel)
329 content, err := os.ReadFile(path)
330 if err == nil {
331 return content, true, nil
332 }
333 if os.IsNotExist(err) {
334 return nil, false, nil
335 }
336 return nil, false, err
337}
338
339func sha256Hex(content []byte) string {
340 sum := sha256.Sum256(content)

Callers 2

BuildDiffFileFunction · 0.85
BuildBlameFileFunction · 0.85

Calls 1

ReadFileMethod · 0.80

Tested by

no test coverage detected