List of usage examples for org.eclipse.jgit.diff DiffFormatter setAbbreviationLength
public void setAbbreviationLength(int count)
From source file:org.review_board.ereviewboard.ui.wizard.DiffCreator.java
License:Open Source License
public byte[] createDiff(Set<ChangedFile> selectedFiles, File rootLocation, Git gitClient) throws IOException, GitAPIException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); List<DiffEntry> changes = new ArrayList<DiffEntry>(selectedFiles.size()); for (ChangedFile changedFile : selectedFiles) { changes.add(changedFile.getDiffEntry()); }/*from w ww.j ava 2 s . c om*/ final int INDEX_LENGTH = 40; DiffFormatter diffFormatter = new DiffFormatter(outputStream); diffFormatter.setRepository(gitClient.getRepository()); diffFormatter.setDiffComparator(RawTextComparator.WS_IGNORE_ALL); diffFormatter.setAbbreviationLength(INDEX_LENGTH); diffFormatter.setDetectRenames(true); diffFormatter.format(changes); diffFormatter.flush(); return outputStream.toByteArray(); }