git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH 1/3] Add lookupBlob to RevWalk
@ 2009-03-13 18:11 Shawn O. Pearce
  2009-03-13 18:11 ` [JGIT PATCH 2/3] Fix ObjectWalk to handle single-entry subtrees correctly Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2009-03-13 18:11 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

Its useful if you want to get a handle on a blob object.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-16 14:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-13 18:11 [JGIT PATCH 1/3] Add lookupBlob to RevWalk Shawn O. Pearce
2009-03-13 18:11 ` [JGIT PATCH 2/3] Fix ObjectWalk to handle single-entry subtrees correctly Shawn O. Pearce
2009-03-13 18:11   ` [JGIT PATCH 3/3] Use a common skipObject method to avoid UNINTERESTING items Shawn O. Pearce
2009-03-15  0:25     ` Robin Rosenberg
2009-03-16 14:13       ` Shawn O. Pearce
2009-03-13 18:37   ` [JGIT PATCH 2/3] Fix ObjectWalk to handle single-entry subtrees correctly Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).