summaryrefslogtreecommitdiff
path: root/checkout.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2015-06-05 02:02:37 +0200
committerCarlos Martín Nieto <[email protected]>2015-06-08 04:07:49 +0200
commit85fde1fcfbc3fd6000b8fa1a4041b4c314a92b2f (patch)
tree80b29ec86120ba092fcd05c05e28e6a65d1f2b13 /checkout.go
parent1011b03e4139580679bb93183a781edd11c22a97 (diff)
parent53c158fbd7e5f4dac787f5c3a7107fcb4116f676 (diff)
Merge remote-tracking branch 'origin/master' into next
Diffstat (limited to 'checkout.go')
-rw-r--r--checkout.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/checkout.go b/checkout.go
index 98c1ee6..d747344 100644
--- a/checkout.go
+++ b/checkout.go
@@ -43,6 +43,7 @@ type CheckoutOpts struct {
FileMode os.FileMode // Default is 0644 or 0755 as dictated by blob
FileOpenFlags int // Default is O_CREAT | O_TRUNC | O_WRONLY
TargetDirectory string // Alternative checkout path to workdir
+ Paths []string
}
func checkoutOptionsFromC(c *C.git_checkout_options) CheckoutOpts {
@@ -83,6 +84,11 @@ func populateCheckoutOpts(ptr *C.git_checkout_options, opts *CheckoutOpts) *C.gi
if opts.TargetDirectory != "" {
ptr.target_directory = C.CString(opts.TargetDirectory)
}
+ if len(opts.Paths) > 0 {
+ ptr.paths.strings = makeCStringsFromStrings(opts.Paths)
+ ptr.paths.count = C.size_t(len(opts.Paths))
+ }
+
return ptr
}
@@ -91,6 +97,9 @@ func freeCheckoutOpts(ptr *C.git_checkout_options) {
return
}
C.free(unsafe.Pointer(ptr.target_directory))
+ if ptr.paths.count > 0 {
+ freeStrarray(&ptr.paths)
+ }
}
// Updates files in the index and the working tree to match the content of
@@ -146,4 +155,4 @@ func (v *Repository) CheckoutTree(tree *Tree, opts *CheckoutOpts) error {
}
return nil
-}
+} \ No newline at end of file