diff options
Diffstat (limited to 'checkout.go')
| -rw-r--r-- | checkout.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/checkout.go b/checkout.go index 5b72b9a..8974a8c 100644 --- a/checkout.go +++ b/checkout.go @@ -5,8 +5,8 @@ package git */ import "C" import ( - "runtime" "os" + "runtime" ) type CheckoutStrategy uint @@ -32,10 +32,19 @@ const ( type CheckoutOpts struct { Strategy CheckoutStrategy // Default will be a dry run - DisableFilters bool // Don't apply filters like CRLF conversion - DirMode os.FileMode // Default is 0755 - FileMode os.FileMode // Default is 0644 or 0755 as dictated by blob - FileOpenFlags int // Default is O_CREAT | O_TRUNC | O_WRONLY + DisableFilters bool // Don't apply filters like CRLF conversion + DirMode os.FileMode // Default is 0755 + FileMode os.FileMode // Default is 0644 or 0755 as dictated by blob + FileOpenFlags int // Default is O_CREAT | O_TRUNC | O_WRONLY +} + +func (opts *CheckoutOpts) toC() *C.git_checkout_options { + if opts == nil { + return nil + } + c := C.git_checkout_options{} + populateCheckoutOpts(&c, opts) + return &c } // Convert the CheckoutOpts struct to the corresponding @@ -46,7 +55,7 @@ func populateCheckoutOpts(ptr *C.git_checkout_options, opts *CheckoutOpts) *C.gi return nil } - C.git_checkout_init_opts(ptr, 1) + C.git_checkout_init_options(ptr, 1) ptr.checkout_strategy = C.uint(opts.Strategy) ptr.disable_filters = cbool(opts.DisableFilters) ptr.dir_mode = C.uint(opts.DirMode.Perm()) |
