MCPcopy Index your code
hub / github.com/ChimeraCoder/gitgo / CatFile

Function CatFile

cat-file.go:22–43  ·  view source on GitHub ↗
(input SHA)

Source from the content-addressed store, hash-verified

20)
21
22func CatFile(input SHA) (result string, err error) {
23
24 filename := path.Join(".git", "objects", string(input[:2]), string(input[2:]))
25
26 f, err := os.Open(filename)
27 if err != nil {
28 return
29 }
30 defer f.Close()
31
32 r, err := zlib.NewReader(f)
33 if err != nil {
34 return
35 }
36
37 bts, err := ioutil.ReadAll(r)
38 if err != nil {
39 return
40 }
41
42 return string(bts), nil
43}

Callers 3

Test_CatFileFunction · 0.85
Test_parseObjFunction · 0.85
NewObjectFunction · 0.85

Calls

no outgoing calls

Tested by 2

Test_CatFileFunction · 0.68
Test_parseObjFunction · 0.68