(osEnv, gitEnv Environment, gitdir, tempdir string)
| 1666 | } |
| 1667 | |
| 1668 | func 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 | |
| 1692 | func remotesForTreeish(treeish string) []string { |
| 1693 | var outp string |
no test coverage detected