Submodule: use the Repository constructor

This commit is contained in:
Carlos Martín Nieto 2015-06-30 19:12:39 +02:00
parent b6811196e4
commit 47191d1274
1 changed files with 3 additions and 4 deletions

View File

@ -298,16 +298,15 @@ func (sub *Submodule) Sync() error {
}
func (sub *Submodule) Open() (*Repository, error) {
repo := new(Repository)
runtime.LockOSThread()
defer runtime.UnlockOSThread()
ret := C.git_submodule_open(&repo.ptr, sub.ptr)
var ptr *C.git_repository
ret := C.git_submodule_open(&ptr, sub.ptr)
if ret < 0 {
return nil, MakeGitError(ret)
}
return repo, nil
return newRepositoryFromC(ptr), nil
}
func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error {