summaryrefslogtreecommitdiff
path: root/cherrypick.go
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2020-12-04 19:54:26 -0800
committerlhchavez <[email protected]>2021-09-05 18:52:01 -0700
commitb78bde3d74b1617d5b635723552aaec0583eb054 (patch)
tree16c98859171b6483b61ac710672694d823db2e1b /cherrypick.go
parent5def02a589a2c1653f4bb515fdec290361a222be (diff)
Make all Options objects consistent
This change makes all Options objects have child Option fields as values (instead of pointers) to mirror the libgit2 interface. It also names them Options instead of Opts to match the current libgit2 nomenclature and removes the Version fields.
Diffstat (limited to 'cherrypick.go')
-rw-r--r--cherrypick.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/cherrypick.go b/cherrypick.go
index 5ba57a5..a0ee0f0 100644
--- a/cherrypick.go
+++ b/cherrypick.go
@@ -9,18 +9,16 @@ import (
)
type CherrypickOptions struct {
- Version uint
- Mainline uint
- MergeOpts MergeOptions
- CheckoutOpts CheckoutOptions
+ Mainline uint
+ MergeOptions MergeOptions
+ CheckoutOptions CheckoutOptions
}
func cherrypickOptionsFromC(c *C.git_cherrypick_options) CherrypickOptions {
opts := CherrypickOptions{
- Version: uint(c.version),
- Mainline: uint(c.mainline),
- MergeOpts: mergeOptionsFromC(&c.merge_opts),
- CheckoutOpts: checkoutOptionsFromC(&c.checkout_opts),
+ Mainline: uint(c.mainline),
+ MergeOptions: mergeOptionsFromC(&c.merge_opts),
+ CheckoutOptions: checkoutOptionsFromC(&c.checkout_opts),
}
return opts
}
@@ -31,8 +29,8 @@ func populateCherrypickOptions(copts *C.git_cherrypick_options, opts *Cherrypick
return nil
}
copts.mainline = C.uint(opts.Mainline)
- populateMergeOptions(&copts.merge_opts, &opts.MergeOpts)
- populateCheckoutOptions(&copts.checkout_opts, &opts.CheckoutOpts, errorTarget)
+ populateMergeOptions(&copts.merge_opts, &opts.MergeOptions)
+ populateCheckoutOptions(&copts.checkout_opts, &opts.CheckoutOptions, errorTarget)
return copts
}
@@ -82,7 +80,7 @@ func (r *Repository) CherrypickCommit(pick, our *Commit, opts CherrypickOptions)
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- cOpts := populateMergeOptions(&C.git_merge_options{}, &opts.MergeOpts)
+ cOpts := populateMergeOptions(&C.git_merge_options{}, &opts.MergeOptions)
defer freeMergeOptions(cOpts)
var ptr *C.git_index