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>