diff options
| author | Carlos Martín Nieto <[email protected]> | 2015-06-28 00:51:17 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2015-06-28 00:51:17 +0200 |
| commit | 4b9cbd78fd266767f6bdf55257c4ee2b1611bbe0 (patch) | |
| tree | c24eb3413b2e5dff1fb84b3740329280da4f5229 /repository.go | |
| parent | ba0a24087a8cd1a354872c95f3efe0224ea84b4b (diff) | |
Create a RemoteCollection for managing remotes
Instead of making the 'Remote' part of the function calls, create a
collection object which serves to namespace the operations for the
remotes.
Diffstat (limited to 'repository.go')
| -rw-r--r-- | repository.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/repository.go b/repository.go index 9917c60..860050f 100644 --- a/repository.go +++ b/repository.go @@ -12,7 +12,16 @@ import ( // Repository type Repository struct { - ptr *C.git_repository + ptr *C.git_repository + // Remotes represents the collection of remotes and can be + // used to add, remove and configure remotes for this + // repository. + Remotes RemoteCollection +} + +func initRepositoryObject(repo *Repository) { + repo.Remotes.repo = repo + runtime.SetFinalizer(repo, (*Repository).Free) } func OpenRepository(path string) (*Repository, error) { @@ -29,7 +38,7 @@ func OpenRepository(path string) (*Repository, error) { return nil, MakeGitError(ret) } - runtime.SetFinalizer(repo, (*Repository).Free) + initRepositoryObject(repo) return repo, nil } @@ -47,7 +56,7 @@ func OpenRepositoryExtended(path string) (*Repository, error) { return nil, MakeGitError(ret) } - runtime.SetFinalizer(repo, (*Repository).Free) + initRepositoryObject(repo) return repo, nil } @@ -65,7 +74,7 @@ func InitRepository(path string, isbare bool) (*Repository, error) { return nil, MakeGitError(ret) } - runtime.SetFinalizer(repo, (*Repository).Free) + initRepositoryObject(repo) return repo, nil } @@ -80,7 +89,7 @@ func NewRepositoryWrapOdb(odb *Odb) (repo *Repository, err error) { return nil, MakeGitError(ret) } - runtime.SetFinalizer(repo, (*Repository).Free) + initRepositoryObject(repo) return repo, nil } |
