@@ -51,7 +51,7 @@ const (
5151type CheckoutNotifyCallback func (why CheckoutNotifyType , path string , baseline , target , workdir DiffFile ) ErrorCode
5252type CheckoutProgressCallback func (path string , completed , total uint ) ErrorCode
5353
54- type CheckoutOpts struct {
54+ type CheckoutOptions struct {
5555 Strategy CheckoutStrategy // Default will be a dry run
5656 DisableFilters bool // Don't apply filters like CRLF conversion
5757 DirMode os.FileMode // Default is 0755
@@ -65,32 +65,33 @@ type CheckoutOpts struct {
6565 Baseline * Tree
6666}
6767
68- func checkoutOptionsFromC (c * C.git_checkout_options ) CheckoutOpts {
69- opts := CheckoutOpts {}
70- opts .Strategy = CheckoutStrategy (c .checkout_strategy )
71- opts .DisableFilters = c .disable_filters != 0
72- opts .DirMode = os .FileMode (c .dir_mode )
73- opts .FileMode = os .FileMode (c .file_mode )
74- opts .FileOpenFlags = int (c .file_open_flags )
75- opts .NotifyFlags = CheckoutNotifyType (c .notify_flags )
68+ func checkoutOptionsFromC (c * C.git_checkout_options ) CheckoutOptions {
69+ opts := CheckoutOptions {
70+ Strategy : CheckoutStrategy (c .checkout_strategy ),
71+ DisableFilters : c .disable_filters != 0 ,
72+ DirMode : os .FileMode (c .dir_mode ),
73+ FileMode : os .FileMode (c .file_mode ),
74+ FileOpenFlags : int (c .file_open_flags ),
75+ NotifyFlags : CheckoutNotifyType (c .notify_flags ),
76+ }
7677 if c .notify_payload != nil {
77- opts .NotifyCallback = pointerHandles .Get (c .notify_payload ).(* CheckoutOpts ).NotifyCallback
78+ opts .NotifyCallback = pointerHandles .Get (c .notify_payload ).(* CheckoutOptions ).NotifyCallback
7879 }
7980 if c .progress_payload != nil {
80- opts .ProgressCallback = pointerHandles .Get (c .progress_payload ).(* CheckoutOpts ).ProgressCallback
81+ opts .ProgressCallback = pointerHandles .Get (c .progress_payload ).(* CheckoutOptions ).ProgressCallback
8182 }
8283 if c .target_directory != nil {
8384 opts .TargetDirectory = C .GoString (c .target_directory )
8485 }
8586 return opts
8687}
8788
88- func (opts * CheckoutOpts ) toC () * C.git_checkout_options {
89+ func (opts * CheckoutOptions ) toC () * C.git_checkout_options {
8990 if opts == nil {
9091 return nil
9192 }
9293 c := C.git_checkout_options {}
93- populateCheckoutOpts (& c , opts )
94+ populateCheckoutOptions (& c , opts )
9495 return & c
9596}
9697
@@ -110,7 +111,7 @@ func checkoutNotifyCallback(why C.git_checkout_notify_t, cpath *C.char, cbaselin
110111 if cworkdir != nil {
111112 workdir = diffFileFromC ((* C .git_diff_file )(cworkdir ))
112113 }
113- opts := pointerHandles .Get (data ).(* CheckoutOpts )
114+ opts := pointerHandles .Get (data ).(* CheckoutOptions )
114115 if opts .NotifyCallback == nil {
115116 return 0
116117 }
@@ -119,17 +120,17 @@ func checkoutNotifyCallback(why C.git_checkout_notify_t, cpath *C.char, cbaselin
119120
120121//export checkoutProgressCallback
121122func checkoutProgressCallback (path * C.char , completed_steps , total_steps C.size_t , data unsafe.Pointer ) int {
122- opts := pointerHandles .Get (data ).(* CheckoutOpts )
123+ opts := pointerHandles .Get (data ).(* CheckoutOptions )
123124 if opts .ProgressCallback == nil {
124125 return 0
125126 }
126127 return int (opts .ProgressCallback (C .GoString (path ), uint (completed_steps ), uint (total_steps )))
127128}
128129
129- // Convert the CheckoutOpts struct to the corresponding
130+ // Convert the CheckoutOptions struct to the corresponding
130131// C-struct. Returns a pointer to ptr, or nil if opts is nil, in order
131132// to help with what to pass.
132- func populateCheckoutOpts (ptr * C.git_checkout_options , opts * CheckoutOpts ) * C.git_checkout_options {
133+ func populateCheckoutOptions (ptr * C.git_checkout_options , opts * CheckoutOptions ) * C.git_checkout_options {
133134 if opts == nil {
134135 return nil
135136 }
@@ -165,7 +166,7 @@ func populateCheckoutOpts(ptr *C.git_checkout_options, opts *CheckoutOpts) *C.gi
165166 return ptr
166167}
167168
168- func freeCheckoutOpts (ptr * C.git_checkout_options ) {
169+ func freeCheckoutOptions (ptr * C.git_checkout_options ) {
169170 if ptr == nil {
170171 return
171172 }
@@ -180,12 +181,12 @@ func freeCheckoutOpts(ptr *C.git_checkout_options) {
180181
181182// Updates files in the index and the working tree to match the content of
182183// the commit pointed at by HEAD. opts may be nil.
183- func (v * Repository ) CheckoutHead (opts * CheckoutOpts ) error {
184+ func (v * Repository ) CheckoutHead (opts * CheckoutOptions ) error {
184185 runtime .LockOSThread ()
185186 defer runtime .UnlockOSThread ()
186187
187188 cOpts := opts .toC ()
188- defer freeCheckoutOpts (cOpts )
189+ defer freeCheckoutOptions (cOpts )
189190
190191 ret := C .git_checkout_head (v .ptr , cOpts )
191192 runtime .KeepAlive (v )
@@ -199,7 +200,7 @@ func (v *Repository) CheckoutHead(opts *CheckoutOpts) error {
199200// Updates files in the working tree to match the content of the given
200201// index. If index is nil, the repository's index will be used. opts
201202// may be nil.
202- func (v * Repository ) CheckoutIndex (index * Index , opts * CheckoutOpts ) error {
203+ func (v * Repository ) CheckoutIndex (index * Index , opts * CheckoutOptions ) error {
203204 var iptr * C.git_index = nil
204205 if index != nil {
205206 iptr = index .ptr
@@ -209,7 +210,7 @@ func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error {
209210 defer runtime .UnlockOSThread ()
210211
211212 cOpts := opts .toC ()
212- defer freeCheckoutOpts (cOpts )
213+ defer freeCheckoutOptions (cOpts )
213214
214215 ret := C .git_checkout_index (v .ptr , iptr , cOpts )
215216 runtime .KeepAlive (v )
@@ -220,12 +221,12 @@ func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error {
220221 return nil
221222}
222223
223- func (v * Repository ) CheckoutTree (tree * Tree , opts * CheckoutOpts ) error {
224+ func (v * Repository ) CheckoutTree (tree * Tree , opts * CheckoutOptions ) error {
224225 runtime .LockOSThread ()
225226 defer runtime .UnlockOSThread ()
226227
227228 cOpts := opts .toC ()
228- defer freeCheckoutOpts (cOpts )
229+ defer freeCheckoutOptions (cOpts )
229230
230231 ret := C .git_checkout_tree (v .ptr , tree .ptr , cOpts )
231232 runtime .KeepAlive (v )
0 commit comments