List of usage examples for org.eclipse.jgit.api BlameCommand setFollowFileRenames
public BlameCommand setFollowFileRenames(boolean follow)
From source file:org.eclipse.orion.server.git.servlets.GitBlameHandlerV1.java
License:Open Source License
public void doBlame(Blame blame, Repository db) throws GitAPIException, IOException { String filePath = blame.getFilePath(); if (db != null && filePath != null) { BlameCommand blameCommand = new BlameCommand(db); blameCommand.setFilePath(filePath); blameCommand.setFollowFileRenames(true); blameCommand.setTextComparator(RawTextComparator.WS_IGNORE_ALL); if (blame.getStartCommit() != null) { blameCommand.setStartCommit(blame.getStartCommit()); }//from w w w .j av a 2s.c om BlameResult result; try { result = blameCommand.call(); } catch (Exception e1) { return; } if (result != null) { blame.clearLines(); RevCommit commit; RevCommit prevCommit = null; String path; String prevPath = null; for (int i = 0; i < result.getResultContents().size(); i++) { try { commit = result.getSourceCommit(i); prevCommit = commit; } catch (NullPointerException e) { commit = prevCommit; } if (!blame.commitExists(commit)) { if (commit != null) { blame.addCommit(commit); } } try { path = commit.getId().getName(); prevPath = path; } catch (NullPointerException e) { path = prevPath; } blame.addLine(path); } } } }