Skip to content

line_shift is not recalculated when hunk is split in PathRanges::add #11369

@jonathantanmy2

Description

@jonathantanmy2

This is most directly visible in tests like https://github.com/gitbutlerapp/gitbutler/blob/master/crates/but-hunk-dependency/src/ranges/tests/path.rs#L139 , where a 7-line hunk was split by an overlapping hunk from a child commit, but the line_shift values weren't recalculated (as far as I can tell, they should be 3 and 3 instead of 7 and 7). When used to shift other stacks when combining path ranges in combine_path_ranges in crates/but-hunk-dependency/src/ranges/mod.rs, this results in incorrect results.

I've created a PR #11368 that demonstrates this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions