aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-10-16 11:18:54 +0200
committerGitHub <noreply@github.com>2018-10-16 11:18:54 +0200
commit07c03d9c05d9370502e3cc5630ec02e46a35e4bc (patch)
treeeccb9ac8ef83d39681fcf5ecc62fb87884136d3f /repository.go
parent236ae868ec4a62af2f7eec79d622ab0ebc94ccef (diff)
parent987c03a3cef828894fabe4ffdcafd2a90e908e4a (diff)
downloadgo-git-07c03d9c05d9370502e3cc5630ec02e46a35e4bc.tar.gz
Merge pull request #984 from mcuadros/open-bare
repository: allow open non-bare repositories as bare
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/repository.go b/repository.go
index 651425d..507ff44 100644
--- a/repository.go
+++ b/repository.go
@@ -175,15 +175,6 @@ func Open(s storage.Storer, worktree billy.Filesystem) (*Repository, error) {
return nil, err
}
- cfg, err := s.Config()
- if err != nil {
- return nil, err
- }
-
- if !cfg.Core.IsBare && worktree == nil {
- return nil, ErrWorktreeNotProvided
- }
-
return newRepository(s, worktree), nil
}
@@ -335,6 +326,8 @@ func dotGitFileToOSFilesystem(path string, fs billy.Filesystem) (bfs billy.Files
// PlainClone a repository into the path with the given options, isBare defines
// if the new repository will be bare or normal. If the path is not empty
// ErrRepositoryAlreadyExists is returned.
+//
+// TODO(mcuadros): move isBare to CloneOptions in v5
func PlainClone(path string, isBare bool, o *CloneOptions) (*Repository, error) {
return PlainCloneContext(context.Background(), path, isBare, o)
}
@@ -346,6 +339,8 @@ func PlainClone(path string, isBare bool, o *CloneOptions) (*Repository, error)
// The provided Context must be non-nil. If the context expires before the
// operation is complete, an error is returned. The context only affects to the
// transport operations.
+//
+// TODO(mcuadros): move isBare to CloneOptions in v5
func PlainCloneContext(ctx context.Context, path string, isBare bool, o *CloneOptions) (*Repository, error) {
r, err := PlainInit(path, isBare)
if err != nil {