Add HunkHeader to represent a single hunk of a file within a patch
The hunk header parses the lines of the hunk, counting up the body
to ensure it matches with the header line. We store the hunks on
on the FileHeader, providing public access to them after a patch
has been parsed.
If the line counts in the body differ from the header we don't make
that an immediate error. This permits a future implementation of
something like "git apply --recount", where the hunk headers can be
recomputed based on the actual hunk contents after a human has done
manual editing. We may also need to parse a corrupt patch and show
it in a visual tool for a human to repair, so aborting with any sort
of exception isn't useful.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>