mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-13 17:16:23 -04:00
Keep indented stderr when copying git output from the command log
Hook and linter output often uses leading spaces for stack traces and continuations. Those lines are visible in the log but were dropped on copy because every two-space-prefixed line was treated as lazygit log noise.
This commit is contained in:
parent
224f8e7e50
commit
a2b21978c6
|
|
@ -119,9 +119,6 @@ func gitOutputLinesAfterHeader(lines []string, startIdx int, gitOutputHeader str
|
|||
if isCopyToClipboardLogLine(line) {
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(line, " ") {
|
||||
continue
|
||||
}
|
||||
if isStartOfNewCommandLogEntry(lines, i) {
|
||||
break
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ func TestGitOutputBlocksFromCommandLogLines(t *testing.T) {
|
|||
assert.Equal(t, []string{"Push\n git push\n\nGit output:\nline1\nline2"}, gitOutputBlocksFromCommandLogLines(lines, gitOutputHeader))
|
||||
}
|
||||
|
||||
func TestGitOutputBlocksIncludeIndentedStderr(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
lines := []string{
|
||||
"Push",
|
||||
" git push",
|
||||
gitOutputHeader,
|
||||
" at foo.go:10",
|
||||
" at bar.go:20",
|
||||
"hook failed",
|
||||
}
|
||||
|
||||
assert.Equal(t, []string{"Push\n git push\n\nGit output:\n at foo.go:10\n at bar.go:20\nhook failed"}, gitOutputBlocksFromCommandLogLines(lines, gitOutputHeader))
|
||||
}
|
||||
|
||||
func TestGitOutputBlocksSkipCopyNotifications(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue