File tree Expand file tree Collapse file tree
pkg/cmd/agent-task/shared Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,14 +342,15 @@ func stripDiffFormat(diff string) string {
342342 }
343343 }
344344
345- // If we found the hunk header end, we strip everything before it.
346- if hunkEndIndex != - 1 {
347- lines = lines [hunkEndIndex + 1 :]
348- } else {
349- // This isn't a diff, so we defensively just return the original string.
345+ // Guard clause: if we didn't find a hunk header, this isn't a diff, so
346+ // we defensively just return the original string.
347+ if hunkEndIndex == - 1 {
350348 return diff
351349 }
352350
351+ // We found the hunk header end; strip everything before it.
352+ lines = lines [hunkEndIndex + 1 :]
353+
353354 // Now we strip the leading + and - from lines, if they exist.
354355 // Note: most of the time, but not all the time, we get a diff without
355356 // these prefixes.
You can’t perform that action at this time.
0 commit comments