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

Function ObjectDatabase

git/git.go:1668–1690  ·  view source on GitHub ↗
(osEnv, gitEnv Environment, gitdir, tempdir string)

Source from the content-addressed store, hash-verified

1666}
1667
1668func ObjectDatabase(osEnv, gitEnv Environment, gitdir, tempdir string) (*gitobj.ObjectDatabase, error) {
1669 var options []gitobj.Option
1670 objdir, ok := osEnv.Get("GIT_OBJECT_DIRECTORY")
1671 if !ok {
1672 objdir = filepath.Join(gitdir, "objects")
1673 }
1674 alternates, _ := osEnv.Get("GIT_ALTERNATE_OBJECT_DIRECTORIES")
1675 if alternates != "" {
1676 options = append(options, gitobj.Alternates(alternates))
1677 }
1678 hashAlgo, _ := gitEnv.Get("extensions.objectformat")
1679 if hashAlgo != "" {
1680 options = append(options, gitobj.ObjectFormat(gitobj.ObjectFormatAlgorithm(hashAlgo)))
1681 }
1682 odb, err := gitobj.FromFilesystem(objdir, tempdir, options...)
1683 if err != nil {
1684 return nil, err
1685 }
1686 if odb.Hasher() == nil {
1687 return nil, errors.New(tr.Tr.Get("unsupported repository hash algorithm %q", hashAlgo))
1688 }
1689 return odb, nil
1690}
1691
1692func remotesForTreeish(treeish string) []string {
1693 var outp string

Callers 2

getObjectDatabaseFunction · 0.92
NewObjectScannerFunction · 0.85

Calls 2

NewFunction · 0.92
GetMethod · 0.65

Tested by

no test coverage detected