From a2b21978c63b5a7ed1e625ad8a25d255a3ea0e57 Mon Sep 17 00:00:00 2001 From: tmwatchanan Date: Sat, 20 Jun 2026 18:43:09 +0700 Subject: [PATCH] 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. --- pkg/gui/command_log_panel.go | 3 --- pkg/gui/command_log_panel_test.go | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pkg/gui/command_log_panel.go b/pkg/gui/command_log_panel.go index ee6b2ae52..be9fdc5b3 100644 --- a/pkg/gui/command_log_panel.go +++ b/pkg/gui/command_log_panel.go @@ -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 } diff --git a/pkg/gui/command_log_panel_test.go b/pkg/gui/command_log_panel_test.go index 6ab059930..3d2074017 100644 --- a/pkg/gui/command_log_panel_test.go +++ b/pkg/gui/command_log_panel_test.go @@ -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()