diff options
| author | lhchavez <[email protected]> | 2020-02-23 14:58:21 +0000 |
|---|---|---|
| committer | lhchavez <[email protected]> | 2020-02-23 14:58:21 +0000 |
| commit | a140f2310f56eb06d37454514e67647a8a49d197 (patch) | |
| tree | fb156488aa27d753c7fe7864b9917a48d027b38e /merge.go | |
| parent | 627447092fa24035ed3cd4cf31932dbef6f5a57f (diff) | |
Add test and runtime.KeepAlive()
Diffstat (limited to 'merge.go')
| -rw-r--r-- | merge.go | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -58,7 +58,9 @@ func (r *Repository) AnnotatedCommitFromFetchHead(branchName string, remoteURL s return nil, MakeGitError(ret) } - return newAnnotatedCommitFromC(ptr, r), nil + annotatedCommit := newAnnotatedCommitFromC(ptr, r) + runtime.KeepAlive(r) + return annotatedCommit, nil } func (r *Repository) LookupAnnotatedCommit(oid *Oid) (*AnnotatedCommit, error) { @@ -71,7 +73,10 @@ func (r *Repository) LookupAnnotatedCommit(oid *Oid) (*AnnotatedCommit, error) { if ret < 0 { return nil, MakeGitError(ret) } - return newAnnotatedCommitFromC(ptr, r), nil + + annotatedCommit := newAnnotatedCommitFromC(ptr, r) + runtime.KeepAlive(r) + return annotatedCommit, nil } func (r *Repository) AnnotatedCommitFromRef(ref *Reference) (*AnnotatedCommit, error) { @@ -85,7 +90,10 @@ func (r *Repository) AnnotatedCommitFromRef(ref *Reference) (*AnnotatedCommit, e if ret < 0 { return nil, MakeGitError(ret) } - return newAnnotatedCommitFromC(ptr, r), nil + + annotatedCommit := newAnnotatedCommitFromC(ptr, r) + runtime.KeepAlive(r) + return annotatedCommit, nil } func (r *Repository) AnnotatedCommitFromRevspec(spec string) (*AnnotatedCommit, error) { @@ -101,7 +109,10 @@ func (r *Repository) AnnotatedCommitFromRevspec(spec string) (*AnnotatedCommit, if ret < 0 { return nil, MakeGitError(ret) } - return newAnnotatedCommitFromC(ptr, r), nil + + annotatedCommit := newAnnotatedCommitFromC(ptr, r) + runtime.KeepAlive(r) + return annotatedCommit, nil } type MergeTreeFlag int |
