diff options
| author | Carlos Martín Nieto <[email protected]> | 2015-09-18 10:49:14 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2015-09-18 10:49:14 +0200 |
| commit | ebf7f15bf9c585102b1c39f6bec5f61a37d18802 (patch) | |
| tree | e4c7f57478ccc86de4a236d26b03249bc6380e94 | |
| parent | 6d3a3499f1639a6272e334f9f74b1e0cf6b0bb49 (diff) | |
| parent | 34fb7e03ecfd3fbe7000ecfac4e30ea719d9879e (diff) | |
Merge branch 'status-options'
| -rw-r--r-- | status.go | 36 |
1 files changed, 13 insertions, 23 deletions
@@ -126,34 +126,24 @@ type StatusOptions struct { Pathspec []string } -func (opts *StatusOptions) toC() *C.git_status_options { - if opts == nil { - return nil - } - - cpathspec := C.git_strarray{} - if opts.Pathspec != nil { - cpathspec.count = C.size_t(len(opts.Pathspec)) - cpathspec.strings = makeCStringsFromStrings(opts.Pathspec) - defer freeStrarray(&cpathspec) - } - - copts := &C.git_status_options{ - version: C.GIT_STATUS_OPTIONS_VERSION, - show: C.git_status_show_t(opts.Show), - flags: C.uint(opts.Flags), - pathspec: cpathspec, - } - - return copts -} - func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, error) { var ptr *C.git_status_list var copts *C.git_status_options if opts != nil { - copts = opts.toC() + cpathspec := C.git_strarray{} + if opts.Pathspec != nil { + cpathspec.count = C.size_t(len(opts.Pathspec)) + cpathspec.strings = makeCStringsFromStrings(opts.Pathspec) + defer freeStrarray(&cpathspec) + } + + copts = &C.git_status_options{ + version: C.GIT_STATUS_OPTIONS_VERSION, + show: C.git_status_show_t(opts.Show), + flags: C.uint(opts.Flags), + pathspec: cpathspec, + } } else { copts = &C.git_status_options{} ret := C.git_status_init_options(copts, C.GIT_STATUS_OPTIONS_VERSION) |
