git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git: how to produce context diffs?

From
Junio C Hamano <junkio@cox.net>
Date
Nov 27, 2006, 19:18 UTC
Message-ID
<7v8xhwhf5j.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200611271516.30425.bruno@clisp.org>
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 ;-).

Previous: Thomas Kolejka
Message 8 of 8 in “git: how to produce context diffs?”
  1. Bruno HaibleNov 27, 2006
  2. Jakub NarebskiNov 27, 2006
  3. SeanNov 27, 2006
  4. Jakub NarebskiNov 27, 2006
  5. SeanNov 27, 2006
  6. SeanNov 27, 2006
  7. Thomas KolejkaNov 27, 2006
  8. Junio C HamanoNov 27, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.