Package org.eclipse.jgit.lib
Class CommitConfig
- java.lang.Object
-
- org.eclipse.jgit.lib.CommitConfig
-
public class CommitConfig extends Object
The standard "commit" configuration parameters.- Since:
- 5.13
-
-
Field Summary
Fields Modifier and Type Field Description static Config.SectionParser<CommitConfig>
KEY
Key forConfig.get(SectionParser)
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCommitEncoding()
Get the encoding of the commit as defined in the giti18n.commitEncoding
property.String
getCommitTemplateContent(Repository repository)
Get the content to the commit template as defined incommit.template
.String
getCommitTemplatePath()
Get the path to the commit template as defined in the gitcommit.template
property.
-
-
-
Field Detail
-
KEY
public static final Config.SectionParser<CommitConfig> KEY
Key forConfig.get(SectionParser)
.
-
-
Method Detail
-
getCommitTemplatePath
@Nullable public String getCommitTemplatePath()
Get the path to the commit template as defined in the gitcommit.template
property.- Returns:
- the path to commit template or
null
if not present.
-
getCommitEncoding
@Nullable public String getCommitEncoding()
Get the encoding of the commit as defined in the giti18n.commitEncoding
property.- Returns:
- the encoding or
null
if not present.
-
getCommitTemplateContent
@Nullable public String getCommitTemplateContent(@NonNull Repository repository) throws FileNotFoundException, IOException, ConfigInvalidException
Get the content to the commit template as defined incommit.template
. If noi18n.commitEncoding
is specified, UTF-8 fallback is used.- Parameters:
repository
- to resolve relative path in local git repo config- Returns:
- content of the commit template or
null
if not present. - Throws:
IOException
- if the template file can not be readFileNotFoundException
- if the template file does not existsConfigInvalidException
- if acommitEncoding
is specified and is invalid- Since:
- 6.0
-
-