aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/blame
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/blame')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java
index 63d0fb2cfb..34e15475c3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.blame;
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
+import static org.eclipse.jgit.lib.FileMode.TYPE_FILE;
import java.io.IOException;
import java.util.Collection;
@@ -942,20 +943,17 @@ public class BlameGenerator {
private boolean find(RevCommit commit, PathFilter path) throws IOException {
treeWalk.setFilter(path);
treeWalk.reset(commit.getTree());
- while (treeWalk.next()) {
- if (path.isDone(treeWalk)) {
- if (treeWalk.getFileMode(0).getObjectType() != OBJ_BLOB)
- return false;
- treeWalk.getObjectId(idBuf, 0);
- return true;
- }
-
- if (treeWalk.isSubtree())
- treeWalk.enterSubtree();
+ if (treeWalk.next() && isFile(treeWalk.getRawMode(0))) {
+ treeWalk.getObjectId(idBuf, 0);
+ return true;
}
return false;
}
+ private static final boolean isFile(int rawMode) {
+ return (rawMode & TYPE_FILE) == TYPE_FILE;
+ }
+
private DiffEntry findRename(RevCommit parent, RevCommit commit,
PathFilter path) throws IOException {
if (renameDetector == null)