summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2013-04-10 17:30:18 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-04-10 17:30:18 -0400
commit8272f6573016abe7e583533f0f1f8cf657f3de91 (patch)
tree7c1435412083fba839adc89e8e69f147425ce248 /org.eclipse.jgit/src
parentad2ffc576b8ba959da02cbab19be14e01c57266b (diff)
parent35be98fb8ffb2b21144f23efc599505fa3d60dd7 (diff)
downloadjgit-8272f6573016abe7e583533f0f1f8cf657f3de91.tar.gz
jgit-8272f6573016abe7e583533f0f1f8cf657f3de91.zip
Merge "LogCommand.all(): filter out refs that do not refer to commit objects"
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
index 70b3658d93..cad2790aca 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
@@ -241,10 +241,23 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
for (Ref ref : getRepository().getAllRefs().values()) {
if(!ref.isPeeled())
ref = getRepository().peel(ref);
+
ObjectId objectId = ref.getPeeledObjectId();
if (objectId == null)
objectId = ref.getObjectId();
- add(objectId);
+ RevCommit commit = null;
+ try {
+ commit = walk.parseCommit(objectId);
+ } catch (MissingObjectException e) {
+ // ignore: the ref points to an object that does not exist;
+ // it should be ignored as traversal starting point.
+ } catch (IncorrectObjectTypeException e) {
+ // ignore: the ref points to an object that is not a commit
+ // (e.g. a tree or a blob);
+ // it should be ignored as traversal starting point.
+ }
+ if (commit != null)
+ add(commit);
}
return this;
}