MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / parseHunkSide

Function parseHunkSide

vcs/git/git_diff_lines.go:207–229  ·  view source on GitHub ↗
(s string, sign byte)

Source from the content-addressed store, hash-verified

205}
206
207func parseHunkSide(s string, sign byte) (start, count int, ok bool) {
208 if len(s) == 0 || s[0] != sign {
209 return 0, 0, false
210 }
211 body := s[1:]
212 commaIdx := strings.IndexByte(body, ',')
213 if commaIdx == -1 {
214 n, err := strconv.Atoi(body)
215 if err != nil {
216 return 0, 0, false
217 }
218 return n, 1, true
219 }
220 start, err := strconv.Atoi(body[:commaIdx])
221 if err != nil {
222 return 0, 0, false
223 }
224 count, err = strconv.Atoi(body[commaIdx+1:])
225 if err != nil {
226 return 0, 0, false
227 }
228 return start, count, true
229}

Callers 1

parseHunkHeaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected