diff options
author | Santiago M. Mola <santi@mola.io> | 2017-05-31 09:02:01 +0200 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-06-01 18:02:26 +0200 |
commit | 88f88ea4cf5d44065edda8b06c2267a9dccea16e (patch) | |
tree | d940fd22f0110274c221ebd22391bc8716cc66bc /plumbing/storer/storer.go | |
parent | 87d2475dd70169bbcb49a70d79ca6cfdff492c38 (diff) | |
download | go-git-88f88ea4cf5d44065edda8b06c2267a9dccea16e.tar.gz |
storage/filesystem: call initialization explicitely, fixes #408
filesystem.Storage was initializing the gitdir (creating objects
and refs) on NewStorage. But this should be done only on init and
clone operations, not on open.
Now there is a new interface storer.Initializer that storers can
implement if they need any initialization step before init or clone.
filesystem.Storage is one of such implementations.
git.Init and git.Clone now call to the storer Init() method if it
does implement it. Otherwise, it just ignores initialization.
Diffstat (limited to 'plumbing/storer/storer.go')
-rw-r--r-- | plumbing/storer/storer.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plumbing/storer/storer.go b/plumbing/storer/storer.go index 0b96c0e..863070d 100644 --- a/plumbing/storer/storer.go +++ b/plumbing/storer/storer.go @@ -5,3 +5,11 @@ type Storer interface { EncodedObjectStorer ReferenceStorer } + +// Initializer should be implemented by storers that require to perform any +// operation when creating a new repository (i.e. git init). +type Initializer interface{ + // Init performs initialization of the storer and returns the error, if + // any. + Init() error +} |