// OpenRepository opens a repository by its path. // // Returns an error in case of failure (e.g.: if the path does not exist; if // it exists but is not a git repository or if the path exists, is a git // repository, but the user does not have access to it). func OpenRepository(path string) (*Repository, error) { repo := new(Repository) cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) if C.git_repository_open(&repo.repository, cpath) != C.GIT_OK { return nil, lastErr() } return repo, nil }
func (v *Repo) Open(path string) (err error) { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) ecode := C.git_repository_open(&v.git_repo, cpath) if ecode != GIT_SUCCESS { return LastError() } return }
func Open(path string) (*Repository, error) { repo := new(Repository) cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) ecode := C.git_repository_open(&repo.git_repository, cpath) if ecode != git_SUCCESS { return nil, gitError() } return repo, nil }
// Open an existing git repository located at the given filesystem path. func OpenRepository(path string) (*Repository, error) { p := C.CString(path) defer C.free(unsafe.Pointer(p)) r := new(Repository) if err := gitError(C.git_repository_open(&r.repo, p)); err != nil { return nil, err } return r, nil }
func OpenRepository(path string) (*Repository, error) { repo := new(Repository) cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) ret := C.git_repository_open(&repo.ptr, cpath) if ret < 0 { return nil, LastError() } runtime.SetFinalizer(repo, (*Repository).Free) return repo, nil }
func OpenRepository(path string) (*Repository, error) { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) runtime.LockOSThread() defer runtime.UnlockOSThread() var ptr *C.git_repository ret := C.git_repository_open(&ptr, cpath) if ret < 0 { return nil, MakeGitError(ret) } return newRepositoryFromC(ptr), nil }