diff options
| author | Carlos Martín Nieto <[email protected]> | 2014-05-26 09:28:07 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2014-05-26 09:28:07 +0200 |
| commit | 8a73c75f1a68f2855d03e6d2ce45c95c414aa71a (patch) | |
| tree | 967dae543c50f926ad728be38ffeaa3fefda7147 /branch.go | |
| parent | f953d4e5c7c676cd3b3ee797fedce8823b5c930c (diff) | |
Keep a pointer to the repository in the objects and references
Otherwise, the garbage collector might decide it's a good idea to throw
away the repository instance while the C object still has a pointer to
it. Hilarity ensues.
Diffstat (limited to 'branch.go')
| -rw-r--r-- | branch.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -57,7 +57,7 @@ func (i *BranchIterator) Next() (*Branch, BranchType, error) { return nil, BranchLocal, MakeGitError(ecode) } - branch := newReferenceFromC(refPtr).Branch() + branch := newReferenceFromC(refPtr, i.repo).Branch() return branch, BranchType(refType), nil } @@ -144,7 +144,7 @@ func (b *Branch) Move(newBranchName string, force bool, signature *Signature, ms if ret < 0 { return nil, MakeGitError(ret) } - return newReferenceFromC(ptr).Branch(), nil + return newReferenceFromC(ptr, b.repo).Branch(), nil } func (b *Branch) IsHead() (bool, error) { @@ -175,7 +175,7 @@ func (repo *Repository) LookupBranch(branchName string, bt BranchType) (*Branch, if ret < 0 { return nil, MakeGitError(ret) } - return newReferenceFromC(ptr).Branch(), nil + return newReferenceFromC(ptr, repo).Branch(), nil } func (b *Branch) Name() (string, error) { @@ -233,7 +233,7 @@ func (b *Branch) Upstream() (*Reference, error) { if ret < 0 { return nil, MakeGitError(ret) } - return newReferenceFromC(ptr), nil + return newReferenceFromC(ptr, b.repo), nil } func (repo *Repository) UpstreamName(canonicalBranchName string) (string, error) { |
