| 1 | // Package filesystem is a storage backend base on filesystems |
| 2 | package filesystemscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ |
| 3 | |
| 4 | import ( |
| 5 | "gopkg.in/src-d/go-git.v4/plumbing/cachescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/plumbing/cache`/" |
| 6 | "gopkg.in/src-d/go-git.v4/storage/filesystem/dotgitscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/" |
| 7 | |
| 8 | "gopkg.in/src-d/go-billy.v4scip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/" |
| 9 | ) |
| 10 | |
| 11 | // Storage is an implementation of git.Storer that stores data on disk in the |
| 12 | // standard git format (this is, the .git directory). Zero values of this type |
| 13 | // are not safe to use, see the NewStorage function below. |
| 14 | type Storagescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage# struct { |
| 15 | fsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#fs. billyscip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/.Filesystemscip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/Filesystem# |
| 16 | dirscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#dir. *dotgitscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/.DotGitscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/DotGit# |
| 17 | |
| 18 | ObjectStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ObjectStorage. |
| 19 | ReferenceStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ReferenceStorage. |
| 20 | IndexStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#IndexStorage. |
| 21 | ShallowStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ShallowStorage. |
| 22 | ConfigStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ConfigStorage. |
| 23 | ModuleStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ModuleStorage. |
| 24 | } |
| 25 | |
| 26 | // Options holds configuration for the storage. |
| 27 | type Optionsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Options# struct { |
| 28 | // ExclusiveAccess means that the filesystem is not modified externally |
| 29 | // while the repo is open. |
| 30 | ExclusiveAccessscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Options#ExclusiveAccess. bool |
| 31 | // KeepDescriptors makes the file descriptors to be reused but they will |
| 32 | // need to be manually closed calling Close(). |
| 33 | KeepDescriptorsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Options#KeepDescriptors. bool |
| 34 | } |
| 35 | |
| 36 | // NewStorage returns a new Storage backed by a given `fs.Filesystem` and cache. |
| 37 | func NewStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/NewStorage().(fs billyscip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/.Filesystemscip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/Filesystem#, cache cachescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/plumbing/cache`/.Objectscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/plumbing/cache`/Object#) *Storagescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage# { |
| 38 | return NewStorageWithOptionsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/NewStorageWithOptions().(fs, cache, Optionsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Options#{}) |
| 39 | } |
| 40 | |
| 41 | // NewStorageWithOptions returns a new Storage with extra options, |
| 42 | // backed by a given `fs.Filesystem` and cache. |
| 43 | func NewStorageWithOptionsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/NewStorageWithOptions().(fs billyscip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/.Filesystemscip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/Filesystem#, cache cachescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/plumbing/cache`/.Objectscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/plumbing/cache`/Object#, ops Optionsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Options#) *Storagescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage# { |
| 44 | dirOps := dotgitscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/.Optionsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/Options#{ |
| 45 | ExclusiveAccessscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/Options#ExclusiveAccess.: ops.ExclusiveAccessscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Options#ExclusiveAccess., |
| 46 | KeepDescriptorsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/Options#KeepDescriptors.: ops.KeepDescriptorsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Options#KeepDescriptors., |
| 47 | } |
| 48 | dir := dotgitscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/.NewWithOptionsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/NewWithOptions().(fs, dirOps) |
| 49 | |
| 50 | return &Storagescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#{ |
| 51 | fsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#fs.: fs, |
| 52 | dirscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#dir.: dir, |
| 53 | |
| 54 | ObjectStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ObjectStorage.: *NewObjectStorageWithOptionsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/NewObjectStorageWithOptions().(dir, cache, ops), |
| 55 | ReferenceStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ReferenceStorage.: ReferenceStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ReferenceStorage#{dirscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ReferenceStorage#dir.: dir}, |
| 56 | IndexStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#IndexStorage.: IndexStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/IndexStorage#{dirscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/IndexStorage#dir.: dir}, |
| 57 | ShallowStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ShallowStorage.: ShallowStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ShallowStorage#{dirscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ShallowStorage#dir.: dir}, |
| 58 | ConfigStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ConfigStorage.: ConfigStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ConfigStorage#{dirscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ConfigStorage#dir.: dir}, |
| 59 | ModuleStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#ModuleStorage.: ModuleStoragescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ModuleStorage#{dirscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/ModuleStorage#dir.: dir}, |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // Filesystem returns the underlying filesystem |
| 64 | func (s *Storagescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#) Filesystemscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#Filesystem().() billyscip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/.Filesystemscip-go gomod gopkg.in/src-d/go-billy.v4 v4.2.1 `gopkg.in/src-d/go-billy.v4`/Filesystem# { |
| 65 | return s.fsscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#fs. |
| 66 | } |
| 67 | |
| 68 | // Init initializes .git directory |
| 69 | func (s *Storagescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#) Initscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#Init().() error { |
| 70 | return s.dirscip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem`/Storage#dir..Initializescip-go gomod gopkg.in/src-d/go-git.v4 . `gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit`/DotGit#Initialize().() |
| 71 | } |