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

Method StatusList

status.go:143–178  ·  view source on GitHub ↗
(opts *StatusOptions)

Source from the content-addressed store, hash-verified

141}
142
143func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, error) {
144 var ptr *C.git_status_list
145 var copts *C.git_status_options
146
147 if opts != nil {
148 cpathspec := C.git_strarray{}
149 if opts.Pathspec != nil {
150 cpathspec.count = C.size_t(len(opts.Pathspec))
151 cpathspec.strings = makeCStringsFromStrings(opts.Pathspec)
152 defer freeStrarray(&cpathspec)
153 }
154
155 copts = &C.git_status_options{
156 version: C.GIT_STATUS_OPTIONS_VERSION,
157 show: C.git_status_show_t(opts.Show),
158 flags: C.uint(opts.Flags),
159 pathspec: cpathspec,
160 }
161 } else {
162 copts = &C.git_status_options{}
163 ret := C.git_status_options_init(copts, C.GIT_STATUS_OPTIONS_VERSION)
164 if ret < 0 {
165 return nil, MakeGitError(ret)
166 }
167 }
168
169 runtime.LockOSThread()
170 defer runtime.UnlockOSThread()
171
172 ret := C.git_status_list_new(&ptr, v.ptr, copts)
173 if ret < 0 {
174 return nil, MakeGitError(ret)
175 }
176
177 return newStatusListFromC(ptr, v), nil
178}
179
180func (v *Repository) StatusFile(path string) (Status, error) {
181 var statusFlags C.uint

Callers 4

checkSecondFileStagedFunction · 0.80
checkNoFilesStagedFunction · 0.80
TestStatusListFunction · 0.80
TestStatusNothingFunction · 0.80

Calls 4

makeCStringsFromStringsFunction · 0.85
freeStrarrayFunction · 0.85
MakeGitErrorFunction · 0.85
newStatusListFromCFunction · 0.85

Tested by 4

checkSecondFileStagedFunction · 0.64
checkNoFilesStagedFunction · 0.64
TestStatusListFunction · 0.64
TestStatusNothingFunction · 0.64