[MPlayer-dev-eng] context diffs

Bryan Henderson giraffedata at gmail.com
Mon Jul 14 02:07:32 CEST 2008


On 7/6/08, The Wanderer <inverseparadox at comcast.net> wrote:

> ... not as so-called context
> diffs (which has always sounded like a misnomer to me, since they in
> fact provide no context at all...)

That's because you're applying the term to the wrong thing.  The diff
above isn't a context diff, it's a "classic diff."  That was the first
format that existed, and when people realized they wanted one with
context, they invented the context diff, which looks like this:

*** xxx Mon Jul 14 00:00:12 2008
--- yyy Mon Jul 14 00:01:00 2008
***************
*** 1,7 ****
  Line 1
  Line 2
  Line 3
! Line 4
  Line 5
  Line 6
  Line 7
--- 1,7 ----
  Line 1
  Line 2
  Line 3
! Line 4 modified
  Line 5
  Line 6
  Line 7

That's got enough context for a patch program to apply it against a
modified base, but it's hard to read, so they invented the "unified
diff":

--- xxx 2008-07-14 00:00:12.000000000 +0000
+++ yyy 2008-07-14 00:01:00.000000000 +0000
@@ -1,7 +1,7 @@
 Line 1
 Line 2
 Line 3
-Line 4
+Line 4 modified
 Line 5
 Line 6
 Line 7

Modern diff and patch programs do all three formats.



More information about the MPlayer-dev-eng mailing list