Thread (8 messages) flat view 8 messages, 5 authors, 2016-08-11

Re: git: how to produce context diffs?

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:35:05

There are a few things to note:

 * Obviously diff.c::builtin_diff() needs to be taught to
   generate the new format, both in the patch text and also in
   the patch and hunk header part.

 * Corresponding changes to builtin-apply.c need to be made;
   most of the functions in the callchain that starts at
   apply_patch() down to apply_one_fragment() need to be taught
   about the copied context format.  Also code to count diffstat
   in builtin-apply.c needs to be adjusted.  This part should be
   done first before diff.c if we were to support copied context
   diff, because we should not be generating what we cannot
   apply.

 * I do not think of a sane way to show a combined diff from
   multiple preimages in copied context format; combine-diff.c
   can probably be left as it is.

I too find larger hunks easier to read with copied context than
with unified context, but what needs to be done listed above is
a nontrivial amount of work.  Since the beginning, git has only
supported unified context format and not copied context format,
and apparently people who lived with git for the last 18 months
have survived without copied context format, so it is of very
low priority even for me right now.

I am not opposed to adding the copied context format as long as
somebody else does the work ;-).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help