MCPcopy
hub / github.com/git-lfs/git-lfs / configureCustomAdapters

Function configureCustomAdapters

tq/custom.go:364–399  ·  view source on GitHub ↗

Initialise custom adapters based on current config

(git Env, m *concreteManifest)

Source from the content-addressed store, hash-verified

362
363// Initialise custom adapters based on current config
364func configureCustomAdapters(git Env, m *concreteManifest) {
365 configureDefaultCustomAdapters(git, m)
366
367 pathRegex := regexp.MustCompile(`lfs.customtransfer.([^.]+).path`)
368 for k, _ := range git.All() {
369 match := pathRegex.FindStringSubmatch(k)
370 if match == nil {
371 continue
372 }
373
374 name := match[1]
375 path, _ := git.Get(k)
376 // retrieve other values
377 args, _ := git.Get(fmt.Sprintf("lfs.customtransfer.%s.args", name))
378 concurrent := git.Bool(fmt.Sprintf("lfs.customtransfer.%s.concurrent", name), true)
379 direction, _ := git.Get(fmt.Sprintf("lfs.customtransfer.%s.direction", name))
380 if len(direction) == 0 {
381 direction = "both"
382 } else {
383 direction = strings.ToLower(direction)
384 }
385
386 // Separate closure for each since we need to capture vars above
387 newfunc := func(name string, dir Direction) Adapter {
388 standalone := m.standaloneTransferAgent != ""
389 return newCustomAdapter(m.fs, name, dir, path, args, concurrent, standalone)
390 }
391
392 if direction == "download" || direction == "both" {
393 m.RegisterNewAdapterFunc(name, Download, newfunc)
394 }
395 if direction == "upload" || direction == "both" {
396 m.RegisterNewAdapterFunc(name, Upload, newfunc)
397 }
398 }
399}
400
401type customAdapterConfig struct {
402 AdapterConfig

Callers 1

newConcreteManifestFunction · 0.85

Calls 6

newCustomAdapterFunction · 0.85
AllMethod · 0.65
GetMethod · 0.65
BoolMethod · 0.65

Tested by

no test coverage detected