Define FileHeader to parse the header block of a git diff
commitffba827bb1601d5bbf174256618729695023f262
authorShawn O. Pearce <spearce@spearce.org>
Thu, 11 Dec 2008 04:58:40 +0000 (10 20:58 -0800)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sat, 13 Dec 2008 02:13:25 +0000 (13 03:13 +0100)
tree45ff135e4a9bb092213d90ac9954401140b4e8f3
parent167c8354b1468ea900863994a874923249d8eada
Define FileHeader to parse the header block of a git diff

This class parses the top header lines of a git style diff, such as:

  diff --git a/SUBMITTING_PATCHES b/Q
  similarity index 100%
  copy from SUBMITTING_PATCHES
  copy to Q

or:

  diff --git a/Q b/Q
  new file mode 100644
  index 0000000..e4a135e
  --- /dev/null
  +++ b/Q

and makes the information available in an object form.  Unit tests
cover the different styles of headers that are commonly created by
C git, including both rename formats.

The hunk header information is not handled by this class, and it
does not have a public API.  It is my intention to wrap this into
a larger container class that handles multiple FileHeaders at once,
with the base case of course being a single FileHeader describing
a patch that impacts only one file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit.test/tst/org/spearce/jgit/patch/FileHeaderTest.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/patch/FileHeader.java [new file with mode: 0644]