Skip to content

fix(review): parse diff hunk headers that omit a side's line count - #1572

Open
kheiner wants to merge 1 commit into
pwntester:masterfrom
kheiner:fix/generate-position2line-nil-offset
Open

kheiner wants to merge 1 commit into
pwntester:masterfrom
kheiner:fix/generate-position2line-nil-offset

Conversation

@kheiner

@kheiner kheiner commented Sep 30, 2026 •

Copy link
Copy Markdown

Describe what this PR does / why we need it

Fixes a crash in generate_position2line_map when a diff hunk header does not include the line count for a single-line side (e.g. @@ -1 +1,2 @@). Without the fix you get crashes <C-j>/preview navigation in :Octo pr list.

Does this pull request fix one issue?

Fixes #1517

Describe how you did it

Widened the hunk-header regex to accept a missing ,<count> on either side.

Describe how to verify it

kheiner#1 reproduces the crash: a one-line addition to .gitignore (which already had exactly 1 line) produces the diff hunk @@ -1 +1,2 @@ and a review comment on it creates a thread with that diffHunk. Opening it with :Octo pr edit 1 kheiner/octo.nvim:

  • Crashes without the fix
  • Renders cleanly with it

Special notes for reviews

Checklist

  • Passing tests and linting standards
  • Documentation updates in README.md and doc/octo.txt (Not applicable)

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.

nil left_side_line in review thread

1 participant