ConfigConstants: Add constants for i18n.logOutputEncoding

Change-Id: I6073c7fc8ec30840e2ee2e90ac4cfdb136f48b9a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-09-30 17:14:50 +09:00
parent d54fc955be
commit a5c0a8dfa5
2 changed files with 19 additions and 2 deletions

View File

@ -45,6 +45,8 @@
package org.eclipse.jgit.pgm;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_SECTION_I18N;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_LOG_OUTPUT_ENCODING;
import static org.eclipse.jgit.lib.Constants.R_HEADS;
import static org.eclipse.jgit.lib.Constants.R_REMOTES;
import static org.eclipse.jgit.lib.Constants.R_TAGS;
@ -181,9 +183,10 @@ public void initRaw(final Repository repository, final String gitDir,
protected void init(Repository repository, String gitDir) {
Charset charset = UTF_8;
if (repository != null) {
String logOutputEncoding = repository.getConfig().getString("i18n", //$NON-NLS-1$
String logOutputEncoding = repository.getConfig().getString(
CONFIG_SECTION_I18N,
null,
"logOutputEncoding");//$NON-NLS-1$
CONFIG_KEY_LOG_OUTPUT_ENCODING);
if (logOutputEncoding != null) {
try {
charset = Charset.forName(logOutputEncoding);

View File

@ -432,4 +432,18 @@ public final class ConfigConstants {
* @since 4.11
*/
public static final String CONFIG_SECTION_LFS = "lfs";
/**
* The "i18n" section
*
* @since 5.2
*/
public static final String CONFIG_SECTION_I18N = "i18n";
/**
* The "logOutputEncoding" key
*
* @since 5.2
*/
public static final String CONFIG_KEY_LOG_OUTPUT_ENCODING = "logOutputEncoding";
}