summaryrefslogtreecommitdiff
path: root/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'git.go')
-rw-r--r--git.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/git.go b/git.go
index bd01b6d..5acff0d 100644
--- a/git.go
+++ b/git.go
@@ -118,6 +118,10 @@ var (
var pointerHandles *HandleList
func init() {
+ initLibGit2()
+}
+
+func initLibGit2() {
pointerHandles = NewHandleList()
C.git_libgit2_init()
@@ -149,6 +153,15 @@ func Shutdown() {
C.git_libgit2_shutdown()
}
+// ReInit reinitializes the global state, this is useful if the effective user
+// id has changed and you want to update the stored search paths for gitconfig
+// files. This function frees any references to objects, so it should be called
+// before any other functions are called.
+func ReInit() {
+ Shutdown()
+ initLibGit2()
+}
+
// Oid represents the id for a Git object.
type Oid [20]byte