mirror of
https://github.com/git-for-windows/git.git
synced 2026-05-02 17:14:01 -05:00
fixup! built-in add -p: implement the hunk splitting feature
A recently-reported bug had its root cause in the `splittable_into` variable overcounting the number of potential hunks (the symptom was misleading, it said that there was an unhandled diff marker). Let's make sure to catch these things earlier, with a less misleading error message. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -853,6 +853,10 @@ static int split_hunk(struct add_p_state *s, struct file_diff *file_diff,
|
||||
|
||||
while (splittable_into > 1) {
|
||||
ch = s->plain.buf[current];
|
||||
|
||||
if (!ch)
|
||||
BUG("buffer overrun while splitting hunks");
|
||||
|
||||
if ((marker == '-' || marker == '+') && ch == ' ') {
|
||||
first = 0;
|
||||
hunk[1].start = current;
|
||||
|
||||
Reference in New Issue
Block a user