This repository was archived by the owner on Sep 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 535
plumbing/storer: add ExclusiveAccess option to Storer #941
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1e1a7d0
git: add Static option to PlainOpen
jfontan 82945e3
git, storer: use a common storer.Options for storer and PlainOpen
jfontan d7e6cf5
dotgit: fix typo in comment
jfontan 2a7c664
git: do not expose storage options in PlainOpen
jfontan cf62667
plumbing/storer: rename Static option to ExclusiveAccess
jfontan 95acbf6
storage/filesystem: make Storage options private
jfontan 874f669
storage/filesystem: move Options to filesytem and dotgit
jfontan 659ec44
storage/dotgit: add ExclusiveAccess tests in dotgit
jfontan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
package filesystem | ||
|
||
import ( | ||
"gopkg.in/src-d/go-git.v4/plumbing/storer" | ||
"gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit" | ||
|
||
"gopkg.in/src-d/go-billy.v4" | ||
|
@@ -11,6 +12,8 @@ import ( | |
// standard git format (this is, the .git directory). Zero values of this type | ||
// are not safe to use, see the NewStorage function below. | ||
type Storage struct { | ||
storer.Options | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is an embedded struct? and not a private field? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right. There's no reason why it should be embedded or public. It's now changed. |
||
|
||
fs billy.Filesystem | ||
dir *dotgit.DotGit | ||
|
||
|
@@ -24,15 +27,24 @@ type Storage struct { | |
|
||
// NewStorage returns a new Storage backed by a given `fs.Filesystem` | ||
func NewStorage(fs billy.Filesystem) (*Storage, error) { | ||
dir := dotgit.New(fs) | ||
return NewStorageWithOptions(fs, storer.Options{}) | ||
} | ||
|
||
// NewStorageWithOptions returns a new Storage backed by a given `fs.Filesystem` | ||
func NewStorageWithOptions( | ||
fs billy.Filesystem, | ||
ops storer.Options, | ||
) (*Storage, error) { | ||
dir := dotgit.NewWithOptions(fs, ops) | ||
o, err := NewObjectStorage(dir) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &Storage{ | ||
fs: fs, | ||
dir: dir, | ||
Options: ops, | ||
fs: fs, | ||
dir: dir, | ||
|
||
ObjectStorage: o, | ||
ReferenceStorage: ReferenceStorage{dir: dir}, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it should be
fun
;)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is fun indeed!