baraja-core / baraja-core/simple-php-diff

Difference in last line does not get handled

オープン
#7 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
11
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

説明

### Bug Description
See title.
`getChangedLines()` does return the correct line numbers.

### Steps To Reproduce
Put a difference in the last line.

### Expected Behavior
The change in the last line should be displayed when calling `getDiff()` or `renderDiff()`.

### Possible Solution
`$captureLine` only gets pushed onto `$return` when a line is equal. When the last line is reached and differs, the for loop is already ending and the capture buffer is not checked anymore.

Seems to work when putting a copy of the `if ($captureBuffer !== [])` block before the `return`.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Inspect the implementation of getDiff() and renderDiff(), focusing on how the capture buffer is handled after the final line. Reproduce a difference on the last line and verify that the resulting diff includes it; the issue is done when both methods display that final-line change.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
backend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。