Add function to open repository from subpaths
This commit is contained in:
parent
80ad996dc1
commit
591a67fef8
|
@ -24,6 +24,24 @@ func OpenRepository(path string) (*Repository, error) {
|
|||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
ret := C.git_repository_open(&repo.ptr, cpath)
|
||||
if ret < 0 {
|
||||
return nil, MakeGitError(ret)
|
||||
}
|
||||
|
||||
runtime.SetFinalizer(repo, (*Repository).Free)
|
||||
return repo, nil
|
||||
}
|
||||
|
||||
func OpenRepositoryExtended(path string) (*Repository, error) {
|
||||
repo := new(Repository)
|
||||
|
||||
cpath := C.CString(path)
|
||||
defer C.free(unsafe.Pointer(cpath))
|
||||
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
ret := C.git_repository_open_ext(&repo.ptr, cpath, 0, nil)
|
||||
if ret < 0 {
|
||||
return nil, MakeGitError(ret)
|
||||
|
|
Loading…
Reference in New Issue