add initLibGit2() to avoid repetition
Go does not allow you to call the package init() function, so instead add a new function to initialize libgit2 and use that function to reduce the repetition in ReInit()
This commit is contained in:
parent
d693954cf5
commit
26cf9e38ff
10
git.go
10
git.go
|
@ -118,6 +118,10 @@ var (
|
||||||
var pointerHandles *HandleList
|
var pointerHandles *HandleList
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
initLibGit2()
|
||||||
|
}
|
||||||
|
|
||||||
|
func initLibGit2() {
|
||||||
pointerHandles = NewHandleList()
|
pointerHandles = NewHandleList()
|
||||||
|
|
||||||
C.git_libgit2_init()
|
C.git_libgit2_init()
|
||||||
|
@ -154,10 +158,8 @@ func Shutdown() {
|
||||||
// files. This function frees any references to objects, so it should be called
|
// files. This function frees any references to objects, so it should be called
|
||||||
// before any other functions are called.
|
// before any other functions are called.
|
||||||
func ReInit() {
|
func ReInit() {
|
||||||
pointerHandles.Clear()
|
Shutdown()
|
||||||
C.git_libgit2_shutdown()
|
initLibGit2()
|
||||||
pointerHandles = NewHandleList()
|
|
||||||
C.git_libgit2_init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Oid represents the id for a Git object.
|
// Oid represents the id for a Git object.
|
||||||
|
|
Loading…
Reference in New Issue