Skip to content

Commit 0c3171c

Browse files
authored
Merge pull request cli#11756 from cli/kw/pr-feedback-for-11752
`gh agent-task view`: PR feedback for cli#11752
2 parents 6eafe96 + 25c0d0c commit 0c3171c

3 files changed

Lines changed: 3 additions & 72 deletions

File tree

pkg/cmd/agent-task/shared/log.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,18 +342,15 @@ func stripDiffFormat(diff string) string {
342342
}
343343
}
344344

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.
345+
// This isn't a diff.
347346
if hunkEndIndex == -1 {
348347
return diff
349348
}
350349

351-
// We found the hunk header end; strip everything before it.
350+
// Removing hunk header.
352351
lines = lines[hunkEndIndex+1:]
353352

354-
// Now we strip the leading + and - from lines, if they exist.
355-
// Note: most of the time, but not all the time, we get a diff without
356-
// these prefixes.
353+
// Strip the leading + and - from lines, if they exist.
357354
var stripped []string
358355
for _, line := range lines {
359356
if strings.HasPrefix(line, "+") || strings.HasPrefix(line, "-") {

pkg/cmd/agent-task/shared/testdata/log-3-input.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

pkg/cmd/agent-task/shared/testdata/log-3-want.txt

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)