Package com.google.gerrit.server.util
Class CommitMessageUtil
- java.lang.Object
- 
- com.google.gerrit.server.util.CommitMessageUtil
 
- 
 public class CommitMessageUtil extends Object Utility functions to manipulate commit messages.
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcheckAndSanitizeCommitMessage(String commitMessage)Checks for invalid (empty or containing \0) commit messages and appends a newline character to the commit message.static org.eclipse.jgit.lib.ObjectIdgenerateChangeId()static Change.KeygenerateKey()static Optional<String>getChangeIdFromCommitMessageFooter(String commitMessage)Return the value of Change-Id from the commit message footer.static StringgetChangeIdFromObjectId(org.eclipse.jgit.lib.ObjectId objectId)
 
- 
- 
- 
Method Detail- 
checkAndSanitizeCommitMessagepublic static String checkAndSanitizeCommitMessage(String commitMessage) throws BadRequestException Checks for invalid (empty or containing \0) commit messages and appends a newline character to the commit message.- Throws:
- BadRequestException- if the commit message is null or empty
 
 - 
generateChangeIdpublic static org.eclipse.jgit.lib.ObjectId generateChangeId() 
 - 
generateKeypublic static Change.Key generateKey() 
 - 
getChangeIdFromObjectIdpublic static String getChangeIdFromObjectId(org.eclipse.jgit.lib.ObjectId objectId) 
 - 
getChangeIdFromCommitMessageFooterpublic static Optional<String> getChangeIdFromCommitMessageFooter(String commitMessage) Return the value of Change-Id from the commit message footer.The behaviour matches ChangeIdUtil. If more than one matching Change-Id footer is found, return the value of the last one.- Parameters:
- commitMessage- commit message to get Change-Id from.
- Returns:
- Optionalvalue of Change-Id footer in the commit message.
 
 
- 
 
-