"Marco Costalba" <mcostalba@xxxxxxxxx> writes: > Ok. This is take 3. It works correctly on standard patches and also on > u0 example that you gave above. > > This patch is on top of git 1.5.2 > > Please check it. I think the checks and actions are at the right places (I haven't looked very closely nor tried to run it yet). > builtin-apply.c | 34 ++++++++++++++++++++++++++++++++++ > 1 files changed, 34 insertions(+), 0 deletions(-) > > diff --git a/builtin-apply.c b/builtin-apply.c > index 0399743..6032f78 100644 > --- a/builtin-apply.c > +++ b/builtin-apply.c > ... > @@ -1770,6 +1800,10 @@ static int apply_one_fragment(struct buffer_desc *desc, > if (match_beginning && offset) > offset = -1; > if (offset >= 0) { > + > + if (desc->size - oldsize - offset == 0) /* end of file? */ > + newsize -= trailing_added_lines; > + > int diff = newsize - oldsize; > unsigned long size = desc->size + diff; > unsigned long alloc = desc->alloc; But we have kept our sources -Wdeclaration-after-statement clean so far, and this hunk needs a trivial adjustment. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html