(init bool, opts *SubmoduleUpdateOptions)
| 365 | } |
| 366 | |
| 367 | func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error { |
| 368 | var err error |
| 369 | cOpts := populateSubmoduleUpdateOptions(&C.git_submodule_update_options{}, opts, &err) |
| 370 | defer freeSubmoduleUpdateOptions(cOpts) |
| 371 | |
| 372 | runtime.LockOSThread() |
| 373 | defer runtime.UnlockOSThread() |
| 374 | |
| 375 | ret := C.git_submodule_update(sub.ptr, cbool(init), cOpts) |
| 376 | runtime.KeepAlive(sub) |
| 377 | if ret == C.int(ErrorCodeUser) && err != nil { |
| 378 | return err |
| 379 | } |
| 380 | if ret < 0 { |
| 381 | return MakeGitError(ret) |
| 382 | } |
| 383 | |
| 384 | return nil |
| 385 | } |
| 386 | |
| 387 | func populateSubmoduleUpdateOptions(copts *C.git_submodule_update_options, opts *SubmoduleUpdateOptions, errorTarget *error) *C.git_submodule_update_options { |
| 388 | C.git_submodule_update_options_init(copts, C.GIT_SUBMODULE_UPDATE_OPTIONS_VERSION) |
nothing calls this directly
no test coverage detected