From a5c0a8dfa57a66bdbeb65138dd565df3154ea9bd Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Sun, 30 Sep 2018 17:14:50 +0900 Subject: [PATCH] ConfigConstants: Add constants for i18n.logOutputEncoding Change-Id: I6073c7fc8ec30840e2ee2e90ac4cfdb136f48b9a Signed-off-by: David Pursehouse --- .../src/org/eclipse/jgit/pgm/TextBuiltin.java | 7 +++++-- .../src/org/eclipse/jgit/lib/ConfigConstants.java | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java index b84a0fd7d..392d1131c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java @@ -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 abstract class TextBuiltin { 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); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java index d4a0280da..196ce64d0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java @@ -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"; }