diff options
| author | Jesse Ezell <[email protected]> | 2014-03-07 16:43:20 -0800 |
|---|---|---|
| committer | Jesse Ezell <[email protected]> | 2014-03-07 16:43:20 -0800 |
| commit | 5e163fa2e8281642dbb9dbf6229a9a20387130d2 (patch) | |
| tree | 4cb1db57f29394349ee1ed6c4c5775dd9a17cbdf /walk.go | |
| parent | f5f8e13744f40300864956fdceb3849c724b9bbb (diff) | |
add blob chunk creation, creation of tree builders for specific trees, minor API cleanup
Diffstat (limited to 'walk.go')
| -rw-r--r-- | walk.go | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -14,11 +14,12 @@ import ( // RevWalk type SortType uint + const ( - SortNone SortType = C.GIT_SORT_NONE - SortTopological = C.GIT_SORT_TOPOLOGICAL - SortTime = C.GIT_SORT_TIME - SortReverse = C.GIT_SORT_REVERSE + SortNone SortType = C.GIT_SORT_NONE + SortTopological = C.GIT_SORT_TOPOLOGICAL + SortTime = C.GIT_SORT_TIME + SortReverse = C.GIT_SORT_REVERSE ) type RevWalk struct { @@ -26,6 +27,12 @@ type RevWalk struct { repo *Repository } +func revWalkFromC(repo *Repository, c *C.git_revwalk) *RevWalk { + v := &RevWalk{ptr: c, repo: repo} + runtime.SetFinalizer(v, (*RevWalk).Free) + return v +} + func (v *RevWalk) Reset() { C.git_revwalk_reset(v.ptr) } @@ -92,6 +99,8 @@ func (v *RevWalk) Sorting(sm SortType) { C.git_revwalk_sorting(v.ptr, C.uint(sm)) } -func freeRevWalk(walk *RevWalk) { - C.git_revwalk_free(walk.ptr) +func (v *RevWalk) Free() { + + runtime.SetFinalizer(v, nil) + C.git_revwalk_free(v.ptr) } |
