Subject: Re: [PATCH, RFC] diff: add option to show context between close chunks

From: Johannes Sixt <[email-masked]>
Date: Mon, 20 Oct 2008 16:32:37 +0200

René Scharfe schrieb:
> This patch adds a new diff option, --inter-chunk-context.  It can be
> used to show the context in gaps between chunks, thereby creating a
> big chunk out of two close chunks, in order to have an unbroken
> context, making reviews easier.
> 
> With --inter-chunk-context=1, patches have the same number of lines
> as without the option, as only the chunk header is replaced by the
> context line it was shadowing.
> 
> You can use commit b0b44bc7b26c8c4b4221a377ce6ba174b843cb8d in the
> git repo to try out this option; there's a chunk in transport.c
> which is just one line away from the next.  (I found this option
> helpful in reviewing my own patch before sending. :)
> 
> I think it makes sense to make 1, or even 3, the default for this
> option for all commands that create patches intended for human
> consumption.  The patch keeps the default at 0, though.
> 
> There are downsides, of course: values higher than 1 potentially make
> the resulting patch longer.  More context means a higher probability
> of (perhaps unnecessary) merge conflicts.
> 
> Comments?

Why can't you just use -U6 instead instead of --inter-chunk-context=3? If
this is intended for human consumption anyway, then you can just as well
increase the overall number of context lines: You get extra context lines
in the places where hunks are not fused, but this cannot be a disadvantage
for the targeted audience.

-- Hannes