summaryrefslogtreecommitdiff
path: root/submodule.go
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2020-12-10 07:19:41 -0800
committerGitHub <[email protected]>2020-12-10 07:19:41 -0800
commit10c67474a89c298172a6703b91980ea37c60d5e5 (patch)
tree8b32fd2ce9540e01e90ddd09b59969d85832dc25 /submodule.go
parente28cce87c7551bffa1f4602ff492348f9a8cba60 (diff)
More callback refactoring (#713)
This change: * Gets rid of the `.toC()` functions for Options objects, since they were redundant with the `populateXxxOptions()`. * Adds support for `errorTarget` to the `RemoteOptions`, since they are used in the same stack for some functions (like `Fetch()`). Now for those cases, the error returned by the callback will be preserved as-is.
Diffstat (limited to 'submodule.go')
-rw-r--r--submodule.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/submodule.go b/submodule.go
index 01474f6..2042125 100644
--- a/submodule.go
+++ b/submodule.go
@@ -383,22 +383,22 @@ func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error {
return nil
}
-func populateSubmoduleUpdateOptions(ptr *C.git_submodule_update_options, opts *SubmoduleUpdateOptions, errorTarget *error) *C.git_submodule_update_options {
- C.git_submodule_update_options_init(ptr, C.GIT_SUBMODULE_UPDATE_OPTIONS_VERSION)
-
+func populateSubmoduleUpdateOptions(copts *C.git_submodule_update_options, opts *SubmoduleUpdateOptions, errorTarget *error) *C.git_submodule_update_options {
+ C.git_submodule_update_options_init(copts, C.GIT_SUBMODULE_UPDATE_OPTIONS_VERSION)
if opts == nil {
return nil
}
- populateCheckoutOptions(&ptr.checkout_opts, opts.CheckoutOpts, errorTarget)
- populateFetchOptions(&ptr.fetch_opts, opts.FetchOptions)
+ populateCheckoutOptions(&copts.checkout_opts, opts.CheckoutOpts, errorTarget)
+ populateFetchOptions(&copts.fetch_opts, opts.FetchOptions, errorTarget)
- return ptr
+ return copts
}
-func freeSubmoduleUpdateOptions(ptr *C.git_submodule_update_options) {
- if ptr == nil {
+func freeSubmoduleUpdateOptions(copts *C.git_submodule_update_options) {
+ if copts == nil {
return
}
- freeCheckoutOptions(&ptr.checkout_opts)
+ freeCheckoutOptions(&copts.checkout_opts)
+ freeFetchOptions(&copts.fetch_opts)
}