MCPcopy Create free account
hub / github.com/cloudflare/artifact-fs / fetchRefTarget

Function fetchRefTarget

internal/gitstore/gitstore.go:1201–1220  ·  view source on GitHub ↗
(repo model.RepoConfig, ref string)

Source from the content-addressed store, hash-verified

1199 parts := strings.SplitN(line, "\t", 2)
1200 if len(parts) != 2 {
1201 return model.BaseNode{}, "", false
1202 }
1203 meta := strings.Fields(parts[0])
1204 if len(meta) < 3 {
1205 return model.BaseNode{}, "", false
1206 }
1207 modeStr := meta[0]
1208 typ := meta[1]
1209 oid := meta[2]
1210 mode64, err := strconv.ParseUint(modeStr, 8, 32)
1211 if err != nil {
1212 return model.BaseNode{}, typ, false
1213 }
1214 mode := uint32(mode64)
1215 if typ == "commit" {
1216 if mode != 0o160000 {
1217 return model.BaseNode{}, typ, false
1218 }
1219 // A gitlink needs a directory placeholder or Git reports the tracked
1220 // submodule as deleted. ArtifactFS does not initialize its contents.
1221 return model.BaseNode{
1222 RepoID: repoID,
1223 Path: parts[1],

Callers 2

PrepareFetchedBranchMethod · 0.85

Calls 1

branchNameFunction · 0.85

Tested by

no test coverage detected