Example usage for org.eclipse.jgit.diff DiffConfig isRenameDetectionEnabled

List of usage examples for org.eclipse.jgit.diff DiffConfig isRenameDetectionEnabled

Introduction

In this page you can find the example usage for org.eclipse.jgit.diff DiffConfig isRenameDetectionEnabled.

Prototype

public boolean isRenameDetectionEnabled() 

Source Link

Document

If rename detection is enabled

Usage

From source file:MyDiffFormatter.java

License:Eclipse Distribution License

/**
 * Set the repository the formatter can load object contents from.
 * <p/>/*from  w  w w.java2 s .  c om*/
 * Once a repository has been set, the formatter must be released to ensure
 * the internal ObjectReader is able to release its resources.
 *
 * @param repository source repository holding referenced objects.
 */
public void setRepository(Repository repository) {
    if (reader != null)
        reader.release();

    db = repository;
    reader = db.newObjectReader();
    diffCfg = db.getConfig().get(DiffConfig.KEY);

    ContentSource cs = ContentSource.create(reader);
    source = new ContentSource.Pair(cs, cs);

    DiffConfig dc = db.getConfig().get(DiffConfig.KEY);
    if (dc.isNoPrefix()) {
        setOldPrefix(""); //$NON-NLS-1$
        setNewPrefix(""); //$NON-NLS-1$
    }
    setDetectRenames(dc.isRenameDetectionEnabled());

    diffAlgorithm = DiffAlgorithm.getAlgorithm(db.getConfig().getEnum(ConfigConstants.CONFIG_DIFF_SECTION, null,
            ConfigConstants.CONFIG_KEY_ALGORITHM, SupportedAlgorithm.HISTOGRAM));

}