• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dcdpr / jp / 25178013449
66%

Build:
DEFAULT BRANCH: main
Ran 30 Apr 2026 04:53PM UTC
Jobs 1
Files 294
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Apr 2026 04:50PM UTC coverage: 64.702% (+0.03%) from 64.672%
25178013449

push

github

web-flow
chore(tools): Fix hunk `+Y` offset when staging a subset of hunks (#592)

When `git diff-files --unified=0` emits hunks for a file, each hunk's
`+Y` value reflects the cumulative line shift of every preceding
unstaged hunk in that file. Staging only a subset of those hunks with
`git apply --cached --unidiff-zero` uses `+Y` to position each change,
so carrying over the full-diff offset causes the patch to land at the
wrong line whenever unselected hunks contributed to the shift.

Two fixes are applied:

For `git_stage_patch`, a `rewrite_hunk_y` helper is introduced in
`hunk.rs` that recomputes each selected hunk's `+Y` from the net line
change of the preceding *selected* hunks only. A `cumulative_offset`
accumulates `(additions - removals)` as hunks are assembled, and each
header is rewritten before the patch is handed to `git apply`.

For `git_stage_patch_lines`, the `HunkHeader` struct previously
preserved `new_start` from the original full-diff header and then
applied it as an offset to the sub-hunk. That offset was wrong for the
same reason. The field is removed and `build_sub_hunk` now derives
`new_start` directly from the sub-hunk's own content: for replacements
and pure removals it equals `old_start`; for pure insertions it equals
`old_start + 1`.

Regression tests are added for both tools covering the scenario where an
addition hunk is staged while an unrelated removal hunk higher in the
file remains unstaged.

Signed-off-by: Jean Mertz <git@jeanmertz.com>

49 of 49 new or added lines in 3 files covered. (100.0%)

24031 of 37141 relevant lines covered (64.7%)

222.66 hits per line

Jobs
ID Job ID Ran Files Coverage
1 25178013449.1 30 Apr 2026 04:53PM UTC 294
64.7
GitHub Action Run
Source Files on build 25178013449
  • Tree
  • List 294
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #25178013449
  • 3b3e154d on github
  • Prev Build on main (#25150647990)
  • Next Build on main (#25259849910)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc