Skip to content

Provide the ability to split hunks #17

@llakala

Description

@llakala

(This is primarily a tracking issue for my own implementation of this.)

This is my favorite feature from git add --patch - if you type s on a patch, it'll attempt to split the hunk, The concept is relatively simple - take a hunk, and when encountering blank lines between added/removed sections, split into multiple hunks. However, the implementation ends up more complicated because of the headache of generating the correct headers. The Git implementation is also difficult to understand, as it's quite undercommented and I'm not as familiar with C as I should be. The only other implementation I can find online is from Emacs, which also isn't very helpful.

To make my life easier in development, I'm planning on first creating a working implementation in Python, as it's a language I'm more personally familiar with. The goal is to simply create a minimum viable product that can split "normal" git patches (the ones that actually have hunks). After that, I can port the implementation back to Ruby and PR it here. As it may require a fair amount of logic, splitting into multiple files may be helpful.

This may take me some time. If anyone wants to help, I'll be working on it at this repo. I'll try to learn from the mistakes of those before me, and document the problems I encounter and the solutions I implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions