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

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

Introduction

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

Prototype

public boolean isNoPrefix() 

Source Link

Document

If prefix should be suppressed

Usage

From source file:MyDiffFormatter.java

License:Eclipse Distribution License

/**
 * Set the repository the formatter can load object contents from.
 * <p/>//from   w  ww.j  a  v  a 2  s . c o m
 * 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));

}