Add parsing support for Signed-off-by lines in commit messages
commit53f54869e25cd735bcfd93976d4570d31e1eb258
authorShawn O. Pearce <spearce@spearce.org>
Wed, 24 Jun 2009 03:11:49 +0000 (23 20:11 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Thu, 25 Jun 2009 05:54:39 +0000 (25 07:54 +0200)
tree8f04e68253aa4b16db8025624f76287c60c933f6
parent9a7d0dc3677067787019ab4e5ea7cd79ce013679
Add parsing support for Signed-off-by lines in commit messages

The RevCommit.getFooterLines() methods now give us direct access to
the Signed-off-by, Acked-by, etc. footer lines in a commit message
body, making it easier to process this information in code.

The value of a SOB line is treated as an opaque string value.  JGit
does not attempt to break it down into a sort of micro PersonIdent,
even though it is very typical for a SOB line to have a name and an
email address.  Since this is very free-form text that a human can
modify when creating a commit object we can't make nearly the same
assumptions about uniformity of value as we can make when parsing
the machine generated commit headers.

To avoid unnecessary byte[] to String conversions we delay the
conversion of a key or a value section of a footer line until the
last possible moment in the application code.  This way we don't
spend time converting text for footer lines that the application
doesn't care to see.  We also can avoid allocating unnecessary
String objects if the application won't care about that particular
footer line value.

The FooterKey object can be used to more efficiently filter out
the footer lines, by using an optimized byte equality test and
avoiding String conversions.  Standard instances for the common
footers like Signed-off-by are supplied as constants, making it
easier for applications to read footers.

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/revwalk/FooterLineTest.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/revwalk/FooterKey.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/revwalk/FooterLine.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/revwalk/RevCommit.java
org.spearce.jgit/src/org/spearce/jgit/util/RawParseUtils.java