From c78b4d665e406af7e8cba608f65ac2171d3917b6 Mon Sep 17 00:00:00 2001 From: Mark Probst Date: Wed, 4 Mar 2015 11:38:19 -0800 Subject: Cherrypick --- checkout.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'checkout.go') diff --git a/checkout.go b/checkout.go index 72a1fe3..6eb6098 100644 --- a/checkout.go +++ b/checkout.go @@ -40,6 +40,19 @@ type CheckoutOpts struct { TargetDirectory string // Alternative checkout path to workdir } +func checkoutOptionsFromC(c *C.git_checkout_options) CheckoutOpts { + opts := CheckoutOpts{} + opts.Strategy = CheckoutStrategy(c.checkout_strategy) + opts.DisableFilters = c.disable_filters != 0 + opts.DirMode = os.FileMode(c.dir_mode) + opts.FileMode = os.FileMode(c.file_mode) + opts.FileOpenFlags = int(c.file_open_flags) + if c.target_directory != nil { + opts.TargetDirectory = C.GoString(c.target_directory) + } + return opts +} + func (opts *CheckoutOpts) toC() *C.git_checkout_options { if opts == nil { return nil -- cgit v1.2.3