Skip to content

Commit ebf7f15

Browse files
committed
Merge branch 'status-options'
2 parents 6d3a349 + 34fb7e0 commit ebf7f15

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

status.go

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -126,34 +126,24 @@ type StatusOptions struct {
126126
Pathspec []string
127127
}
128128

129-
func (opts *StatusOptions) toC() *C.git_status_options {
130-
if opts == nil {
131-
return nil
132-
}
133-
134-
cpathspec := C.git_strarray{}
135-
if opts.Pathspec != nil {
136-
cpathspec.count = C.size_t(len(opts.Pathspec))
137-
cpathspec.strings = makeCStringsFromStrings(opts.Pathspec)
138-
defer freeStrarray(&cpathspec)
139-
}
140-
141-
copts := &C.git_status_options{
142-
version: C.GIT_STATUS_OPTIONS_VERSION,
143-
show: C.git_status_show_t(opts.Show),
144-
flags: C.uint(opts.Flags),
145-
pathspec: cpathspec,
146-
}
147-
148-
return copts
149-
}
150-
151129
func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, error) {
152130
var ptr *C.git_status_list
153131
var copts *C.git_status_options
154132

155133
if opts != nil {
156-
copts = opts.toC()
134+
cpathspec := C.git_strarray{}
135+
if opts.Pathspec != nil {
136+
cpathspec.count = C.size_t(len(opts.Pathspec))
137+
cpathspec.strings = makeCStringsFromStrings(opts.Pathspec)
138+
defer freeStrarray(&cpathspec)
139+
}
140+
141+
copts = &C.git_status_options{
142+
version: C.GIT_STATUS_OPTIONS_VERSION,
143+
show: C.git_status_show_t(opts.Show),
144+
flags: C.uint(opts.Flags),
145+
pathspec: cpathspec,
146+
}
157147
} else {
158148
copts = &C.git_status_options{}
159149
ret := C.git_status_init_options(copts, C.GIT_STATUS_OPTIONS_VERSION)

0 commit comments

Comments
 (0)