[JGIT PATCH 1/3] Add lookupBlob to RevWalk
From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:46:23
Subsystem:
the rest · Maintainer:
Linus Torvalds
Its useful if you want to get a handle on a blob object. Signed-off-by: Shawn O. Pearce <redacted> --- .../src/org/spearce/jgit/revwalk/RevWalk.java | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
index 316f722..e47f9d9 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java@@ -510,6 +510,25 @@ public void setTreeFilter(final TreeFilter newFilter) { } /** + * Locate a reference to a blob without loading it. + * <p> + * The blob may or may not exist in the repository. It is impossible to tell + * from this method's return value. + * + * @param id + * name of the blob object. + * @return reference to the blob object. Never null. + */ + public RevBlob lookupBlob(final AnyObjectId id) { + RevBlob c = (RevBlob) objects.get(id); + if (c == null) { + c = new RevBlob(id); + objects.add(c); + } + return c; + } + + /** * Locate a reference to a tree without loading it. * <p> * The tree may or may not exist in the repository. It is impossible to tell
--
1.6.2.288.gc3f22