diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-30 16:24:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 16:24:07 +0100 |
commit | a24e40af0aa2d9d512051269993a1b08c0496d12 (patch) | |
tree | 65936a6a365263c93e4b57c3b67aad6a13489e68 /storage/memory/storage.go | |
parent | a48bc6e17ef6298f93ec21cdf1a5e387640673b6 (diff) | |
parent | 35378e7db9288e8244f2634a1b47981606731cef (diff) | |
download | go-git-a24e40af0aa2d9d512051269993a1b08c0496d12.tar.gz |
Merge pull request #229 from mcuadros/worktree
Worktree and new Repository Contructors
Diffstat (limited to 'storage/memory/storage.go')
-rw-r--r-- | storage/memory/storage.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/storage/memory/storage.go b/storage/memory/storage.go index ecf2efa..5d0bff1 100644 --- a/storage/memory/storage.go +++ b/storage/memory/storage.go @@ -6,6 +6,7 @@ import ( "gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/format/index" "gopkg.in/src-d/go-git.v4/plumbing/storer" ) @@ -19,6 +20,7 @@ type Storage struct { ConfigStorage ObjectStorage ShallowStorage + IndexStorage ReferenceStorage } @@ -59,6 +61,23 @@ func (c *ConfigStorage) Config() (*config.Config, error) { return c.config, nil } +type IndexStorage struct { + index *index.Index +} + +func (c *IndexStorage) SetIndex(idx *index.Index) error { + c.index = idx + return nil +} + +func (c *IndexStorage) Index() (*index.Index, error) { + if c.index == nil { + c.index = &index.Index{Version: 2} + } + + return c.index, nil +} + type ObjectStorage struct { Objects map[plumbing.Hash]plumbing.EncodedObject Commits map[plumbing.Hash]plumbing.EncodedObject |