]> source.dussan.org Git - jgit.git/commit
Correct diff header formatting 85/1485/1
authorShawn O. Pearce <spearce@spearce.org>
Wed, 1 Sep 2010 02:28:15 +0000 (19:28 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 1 Sep 2010 17:19:43 +0000 (10:19 -0700)
commitdf8adefe86934cbd25982527780b5eed9a1feae1
treee8dcf03d198c4b216bcd63eaa745a43738524828
parent797d5c4d4080c132ff2d5272ea4d6cffc9c903ba
Correct diff header formatting

When adding or deleting a file, we shouldn't ever prefix /dev/null
with the a/ or b/ prefixes.  Doing so is a mistake and confuses a
patch parser which handles /dev/null magically, while a/dev/null is
a file called null in the dev directory of the project.

Also when adding or deleting the "diff --git" line has the "real"
path on both sides, so we should see the following when adding the
file called foo:

  diff --git a/foo b/foo
  --- /dev/null
  +++ b/foo

The --- and +++ lines do not appear in a pure rename or copy delta,
C Git diff seems to omit these, so we now omit them as well.  We also
omit the index line when the ObjectIds are exactly equal.

Change-Id: Ic46892dea935ee8bdee29088aab96307d7ec6d3d
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java