MCPcopy Create free account
hub / github.com/libgit2/git2go / populateCheckoutOptions

Function populateCheckoutOptions

checkout.go:142–180  ·  view source on GitHub ↗

populateCheckoutOptions populates the provided C-struct with the contents of the provided CheckoutOptions struct. Returns copts, or nil if opts is nil, in order to help with what to pass.

(copts *C.git_checkout_options, opts *CheckoutOptions, errorTarget *error)

Source from the content-addressed store, hash-verified

140// the provided CheckoutOptions struct. Returns copts, or nil if opts is nil,
141// in order to help with what to pass.
142func populateCheckoutOptions(copts *C.git_checkout_options, opts *CheckoutOptions, errorTarget *error) *C.git_checkout_options {
143 C.git_checkout_options_init(copts, C.GIT_CHECKOUT_OPTIONS_VERSION)
144 if opts == nil {
145 return nil
146 }
147
148 copts.checkout_strategy = C.uint(opts.Strategy)
149 copts.disable_filters = cbool(opts.DisableFilters)
150 copts.dir_mode = C.uint(opts.DirMode.Perm())
151 copts.file_mode = C.uint(opts.FileMode.Perm())
152 copts.notify_flags = C.uint(opts.NotifyFlags)
153 if opts.NotifyCallback != nil || opts.ProgressCallback != nil {
154 C._go_git_populate_checkout_callbacks(copts)
155 data := &checkoutCallbackData{
156 options: opts,
157 errorTarget: errorTarget,
158 }
159 payload := pointerHandles.Track(data)
160 if opts.NotifyCallback != nil {
161 copts.notify_payload = payload
162 }
163 if opts.ProgressCallback != nil {
164 copts.progress_payload = payload
165 }
166 }
167 if opts.TargetDirectory != "" {
168 copts.target_directory = C.CString(opts.TargetDirectory)
169 }
170 if len(opts.Paths) > 0 {
171 copts.paths.strings = makeCStringsFromStrings(opts.Paths)
172 copts.paths.count = C.size_t(len(opts.Paths))
173 }
174
175 if opts.Baseline != nil {
176 copts.baseline = opts.Baseline.cast_ptr
177 }
178
179 return copts
180}
181
182func freeCheckoutOptions(copts *C.git_checkout_options) {
183 if copts == nil {

Callers 11

populateRebaseOptionsFunction · 0.85
populateRevertOptionsFunction · 0.85
ResetToCommitMethod · 0.85
populateCloneOptionsFunction · 0.85
MergeMethod · 0.85
CheckoutHeadMethod · 0.85
CheckoutIndexMethod · 0.85
CheckoutTreeMethod · 0.85

Calls 3

cboolFunction · 0.85
makeCStringsFromStringsFunction · 0.85
TrackMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…