|
|
@ -48,6 +48,7 @@ import java.text.MessageFormat; |
|
|
|
import org.eclipse.jgit.internal.JGitText; |
|
|
|
import org.eclipse.jgit.internal.JGitText; |
|
|
|
import org.eclipse.jgit.lib.Config; |
|
|
|
import org.eclipse.jgit.lib.Config; |
|
|
|
import org.eclipse.jgit.lib.Config.SectionParser; |
|
|
|
import org.eclipse.jgit.lib.Config.SectionParser; |
|
|
|
|
|
|
|
import org.eclipse.jgit.lib.ConfigConstants; |
|
|
|
import org.eclipse.jgit.util.StringUtils; |
|
|
|
import org.eclipse.jgit.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
/** Keeps track of diff related configuration options. */ |
|
|
|
/** Keeps track of diff related configuration options. */ |
|
|
@ -78,10 +79,12 @@ public class DiffConfig { |
|
|
|
private final int renameLimit; |
|
|
|
private final int renameLimit; |
|
|
|
|
|
|
|
|
|
|
|
private DiffConfig(final Config rc) { |
|
|
|
private DiffConfig(final Config rc) { |
|
|
|
noPrefix = rc.getBoolean("diff", "noprefix", false); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
noPrefix = rc.getBoolean(ConfigConstants.CONFIG_DIFF_SECTION, |
|
|
|
renameDetectionType = parseRenameDetectionType(rc.getString("diff", //$NON-NLS-1$
|
|
|
|
ConfigConstants.CONFIG_KEY_NOPREFIX, false); |
|
|
|
null, "renames")); //$NON-NLS-1$
|
|
|
|
renameDetectionType = parseRenameDetectionType(rc.getString( |
|
|
|
renameLimit = rc.getInt("diff", "renamelimit", 200); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
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. */ |
|
|
|
/** @return true if the prefix "a/" and "b/" should be suppressed. */ |
|
|
@ -108,16 +111,21 @@ public class DiffConfig { |
|
|
|
final String renameString) { |
|
|
|
final String renameString) { |
|
|
|
if (renameString == null) |
|
|
|
if (renameString == null) |
|
|
|
return RenameDetectionType.FALSE; |
|
|
|
return RenameDetectionType.FALSE; |
|
|
|
else if (StringUtils.equalsIgnoreCase("copy", renameString) //$NON-NLS-1$
|
|
|
|
else if (StringUtils.equalsIgnoreCase( |
|
|
|
|| StringUtils.equalsIgnoreCase("copies", renameString)) //$NON-NLS-1$
|
|
|
|
ConfigConstants.CONFIG_RENAMELIMIT_COPY, renameString) |
|
|
|
|
|
|
|
|| StringUtils |
|
|
|
|
|
|
|
.equalsIgnoreCase( |
|
|
|
|
|
|
|
ConfigConstants.CONFIG_RENAMELIMIT_COPIES, |
|
|
|
|
|
|
|
renameString)) |
|
|
|
return RenameDetectionType.COPY; |
|
|
|
return RenameDetectionType.COPY; |
|
|
|
else { |
|
|
|
else { |
|
|
|
final Boolean renameBoolean = StringUtils |
|
|
|
final Boolean renameBoolean = StringUtils |
|
|
|
.toBooleanOrNull(renameString); |
|
|
|
.toBooleanOrNull(renameString); |
|
|
|
if (renameBoolean == null) |
|
|
|
if (renameBoolean == null) |
|
|
|
throw new IllegalArgumentException(MessageFormat.format( |
|
|
|
throw new IllegalArgumentException(MessageFormat.format( |
|
|
|
JGitText.get().enumValueNotSupported2, "diff", //$NON-NLS-1$
|
|
|
|
JGitText.get().enumValueNotSupported2, |
|
|
|
"renames", renameString)); //$NON-NLS-1$
|
|
|
|
ConfigConstants.CONFIG_DIFF_SECTION, |
|
|
|
|
|
|
|
ConfigConstants.CONFIG_KEY_RENAMES, renameString)); |
|
|
|
else if (renameBoolean.booleanValue()) |
|
|
|
else if (renameBoolean.booleanValue()) |
|
|
|
return RenameDetectionType.TRUE; |
|
|
|
return RenameDetectionType.TRUE; |
|
|
|
else |
|
|
|
else |
|
|
|