MCPcopy Index your code
hub / github.com/belak/gitdir / GetFile

Method GetFile

internal/git/operations.go:11–18  ·  view source on GitHub ↗

GetFile is a convenience method to get the contents of a file in the repo.

(filename string)

Source from the content-addressed store, hash-verified

9
10// GetFile is a convenience method to get the contents of a file in the repo.
11func (r *Repository) GetFile(filename string) ([]byte, error) {
12 f, err := r.WorktreeFS.Open(filename)
13 if err != nil {
14 return nil, err
15 }
16
17 return io.ReadAll(f)
18}
19
20// FileExists returns true if the given path exists and is a regular file in the
21// repository worktree.

Callers 4

UpdateFileMethod · 0.95
loadOrgConfigMethod · 0.80
loadAdminConfigMethod · 0.80
loadUserConfigMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected