Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix non-TTY gh issue view --comments output for zero-comment issues#13482

Open
sergiou87 wants to merge 1 commit into
trunkfrom
fix-13452-issue-view-comments-nontty
Open

Fix non-TTY gh issue view --comments output for zero-comment issues#13482
sergiou87 wants to merge 1 commit into
trunkfrom
fix-13452-issue-view-comments-nontty

Conversation

@sergiou87
Copy link
Copy Markdown

Fixes #13452

Summary

  • include the raw issue preview in non-TTY output when gh issue view --comments is used
  • keep appending raw comments after the preview when comments exist
  • add a regression test for the zero-comment case

Testing

  • go test ./pkg/cmd/issue/view/...
  • built gh locally and reran the issue reproduction commands against saurabhav88/EnviousWispr#779
  • go test ./... hits an unrelated local safe.bareRepository failure in git/client_test.go
  • make lint requires golangci-lint in the local environment

Include the raw issue preview in non-TTY output when --comments is used so issues with zero comments no longer emit empty output.

Add a regression test covering the zero-comment case.

Co-authored-by: Copilot <[email protected]>
@sergiou87 sergiou87 marked this pull request as ready for review May 21, 2026 16:25
@sergiou87 sergiou87 requested a review from a team as a code owner May 21, 2026 16:25
@sergiou87 sergiou87 requested review from babakks and Copilot May 21, 2026 16:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression where gh issue view --comments produced no output when stdout is non-TTY and the issue had zero comments, by ensuring the raw issue preview is always printed and comments are appended only when present.

Changes:

  • Always print the raw (non-TTY) issue preview even when --comments is provided.
  • Append raw comments after the preview only when at least one comment node exists.
  • Add a regression test covering the --comments + zero-comments non-TTY scenario.
Show a summary per file
File Description
pkg/cmd/issue/view/view.go Adjusts non-TTY execution path to always emit the raw issue preview and conditionally append raw comments.
pkg/cmd/issue/view/view_test.go Extends non-TTY tests to assert preview output for --comments, including the zero-comment regression case.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh issue view <N> --comments silently emits 0 bytes to non-TTY pipe (regression in 2.92.0)

2 participants