diff options
| author | Carlos Martín Nieto <[email protected]> | 2015-03-11 17:05:16 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2015-03-11 17:05:16 +0100 |
| commit | d300110b8582cd44511efc26a7a0ce04d409f8ce (patch) | |
| tree | 58652052be2848d110ff3c894517452577f44a95 /submodule.go | |
| parent | 755721e68453c5d6de0681789dbe3307744fc9c4 (diff) | |
| parent | 9eae50f29a69fa47cecf3cf4dfb032414cf27a50 (diff) | |
Merge pull request #178 from schani/master
Fixes and improvements
Diffstat (limited to 'submodule.go')
| -rw-r--r-- | submodule.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/submodule.go b/submodule.go index 6923c61..7c6c922 100644 --- a/submodule.go +++ b/submodule.go @@ -318,7 +318,10 @@ func (repo *Repository) ReloadAllSubmodules(force bool) error { func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error { var copts C.git_submodule_update_options - populateSubmoduleUpdateOptions(&copts, opts) + err := populateSubmoduleUpdateOptions(&copts, opts) + if err != nil { + return err + } runtime.LockOSThread() defer runtime.UnlockOSThread() @@ -331,15 +334,22 @@ func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error { return nil } -func populateSubmoduleUpdateOptions(ptr *C.git_submodule_update_options, opts *SubmoduleUpdateOptions) { +func populateSubmoduleUpdateOptions(ptr *C.git_submodule_update_options, opts *SubmoduleUpdateOptions) error { C.git_submodule_update_init_options(ptr, C.GIT_SUBMODULE_UPDATE_OPTIONS_VERSION) if opts == nil { - return + return nil } populateCheckoutOpts(&ptr.checkout_opts, opts.CheckoutOpts) populateRemoteCallbacks(&ptr.remote_callbacks, opts.RemoteCallbacks) ptr.clone_checkout_strategy = C.uint(opts.CloneCheckoutStrategy) - ptr.signature = opts.Signature.toC() + + sig, err := opts.Signature.toC() + if err != nil { + return err + } + ptr.signature = sig + + return nil } |
