summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2013-04-08 01:13:41 +0200
committerChris Aniszczyk <zx@twitter.com>2013-04-19 10:29:45 -0500
commitee222a3be1e8b902667a739625047eef29154924 (patch)
tree62cdca761700c20d26c4cb8224d4e31a7ad8e360 /org.eclipse.jgit
parent2396bab3396ae3d7d99adeb5a81f32604deba825 (diff)
downloadjgit-ee222a3be1e8b902667a739625047eef29154924.tar.gz
jgit-ee222a3be1e8b902667a739625047eef29154924.zip
Create constants in ConfigConstants for the "diff" section
Change-Id: I5cf5fe60374d1e94eb031488e4f92c8e521f41a6 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java24
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java30
2 files changed, 46 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java
index 13874004d5..b1cbb914d8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java
@@ -48,6 +48,7 @@ import java.text.MessageFormat;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Config.SectionParser;
+import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.util.StringUtils;
/** Keeps track of diff related configuration options. */
@@ -78,10 +79,12 @@ public class DiffConfig {
private final int renameLimit;
private DiffConfig(final Config rc) {
- noPrefix = rc.getBoolean("diff", "noprefix", false); //$NON-NLS-1$ //$NON-NLS-2$
- renameDetectionType = parseRenameDetectionType(rc.getString("diff", //$NON-NLS-1$
- null, "renames")); //$NON-NLS-1$
- renameLimit = rc.getInt("diff", "renamelimit", 200); //$NON-NLS-1$ //$NON-NLS-2$
+ noPrefix = rc.getBoolean(ConfigConstants.CONFIG_DIFF_SECTION,
+ ConfigConstants.CONFIG_KEY_NOPREFIX, false);
+ renameDetectionType = parseRenameDetectionType(rc.getString(
+ ConfigConstants.CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_RENAMES));
+ renameLimit = rc.getInt(ConfigConstants.CONFIG_DIFF_SECTION,
+ ConfigConstants.CONFIG_KEY_RENAMELIMIT, 200);
}
/** @return true if the prefix "a/" and "b/" should be suppressed. */
@@ -108,16 +111,21 @@ public class DiffConfig {
final String renameString) {
if (renameString == null)
return RenameDetectionType.FALSE;
- else if (StringUtils.equalsIgnoreCase("copy", renameString) //$NON-NLS-1$
- || StringUtils.equalsIgnoreCase("copies", renameString)) //$NON-NLS-1$
+ else if (StringUtils.equalsIgnoreCase(
+ ConfigConstants.CONFIG_RENAMELIMIT_COPY, renameString)
+ || StringUtils
+ .equalsIgnoreCase(
+ ConfigConstants.CONFIG_RENAMELIMIT_COPIES,
+ renameString))
return RenameDetectionType.COPY;
else {
final Boolean renameBoolean = StringUtils
.toBooleanOrNull(renameString);
if (renameBoolean == null)
throw new IllegalArgumentException(MessageFormat.format(
- JGitText.get().enumValueNotSupported2, "diff", //$NON-NLS-1$
- "renames", renameString)); //$NON-NLS-1$
+ JGitText.get().enumValueNotSupported2,
+ ConfigConstants.CONFIG_DIFF_SECTION,
+ ConfigConstants.CONFIG_KEY_RENAMES, renameString));
else if (renameBoolean.booleanValue())
return RenameDetectionType.TRUE;
else
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 fc0e06a700..3ff4eefb1c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -195,4 +195,34 @@ public class ConfigConstants {
* @since 3.0
*/
public static final String CONFIG_KEY_CHECKSTAT = "checkstat";
+
+ /**
+ * The "renamelimit" key in the "diff section"
+ * @since 3.0
+ */
+ public static final String CONFIG_KEY_RENAMELIMIT = "renamelimit";
+
+ /**
+ * The "noprefix" key in the "diff section"
+ * @since 3.0
+ */
+ public static final String CONFIG_KEY_NOPREFIX = "noprefix";
+
+ /**
+ * A "renamelimit" value in the "diff section"
+ * @since 3.0
+ */
+ public static final String CONFIG_RENAMELIMIT_COPY = "copy";
+
+ /**
+ * A "renamelimit" value in the "diff section"
+ * @since 3.0
+ */
+ public static final String CONFIG_RENAMELIMIT_COPIES = "copies";
+
+ /**
+ * The "renames" key in the "diff section"
+ * @since 3.0
+ */
+ public static final String CONFIG_KEY_RENAMES = "renames";
}