From 8adbc08d70642e2d281654a9122b6c5ecfe1d2a7 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Tue, 6 Jan 2015 14:02:44 -0800 Subject: Fix inconsistent function call in Submodule. --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor') diff --git a/vendor/libgit2 b/vendor/libgit2 index 55d9c29..007f3ff 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 55d9c29aa0c69cdd766c5100fc012d8e0b486e23 +Subproject commit 007f3ff6fa68a95feee4e70f825a49ea0ec9cb2d -- cgit v1.2.3 From 9b914e07cc314daa42e61807b23350b2571f643f Mon Sep 17 00:00:00 2001 From: David Calavera Date: Thu, 8 Jan 2015 13:44:58 -0800 Subject: Add Submodule.Update method. Update libgit2 to a version that includes https://github.com/libgit2/libgit2/pull/2804. --- submodule.go | 30 ++++++++++++++++++++++++++++++ vendor/libgit2 | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'vendor') diff --git a/submodule.go b/submodule.go index bb86a0a..67e4fab 100644 --- a/submodule.go +++ b/submodule.go @@ -316,3 +316,33 @@ func (repo *Repository) ReloadAllSubmodules(force bool) error { } return nil } + +func (sub *Submodule) Update(init bool, opts *SubmoduleUpdateOptions) error { + var copts C.git_submodule_update_options + populateSubmoduleUpdateOptions(&copts, opts) + + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + ret := C.git_submodule_update(sub.ptr, cbool(init), &copts) + if ret < 0 { + return MakeGitError(ret) + } + + return nil +} + +func populateSubmoduleUpdateOptions(ptr *C.git_submodule_update_options, opts *SubmoduleUpdateOptions) { + C.git_submodule_update_init_options(ptr, C.GIT_SUBMODULE_UPDATE_OPTIONS_VERSION) + + if opts == nil { + return + } + + populateCheckoutOpts(&ptr.checkout_opts, opts.CheckoutOpts) + populateRemoteCallbacks(&ptr.remote_callbacks, opts.RemoteCallbacks) + ptr.clone_checkout_strategy = C.uint(opts.CloneCheckoutStrategy) + if opts.Signature != nil { + ptr.signature = opts.Signature.toC() + } +} diff --git a/vendor/libgit2 b/vendor/libgit2 index 007f3ff..1646412 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 007f3ff6fa68a95feee4e70f825a49ea0ec9cb2d +Subproject commit 1646412d8fc9e1532a194df2515e9a5fde4da988 -- cgit v1.2.3