{"thread":{"id":"7210","subject":"[PATCH] Distignuish between commit id and key in commit cache","startedAt":"2007-03-12T17:51:15Z","lastAt":"2007-03-12T21:05:40Z","messageCount":2,"participants":["Robin Rosenberg","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"36929","messageId":"20070312175115.10884.87646.stgit@lathund.dewire.com","threadId":"7210","inReplyTo":null,"subject":"[PATCH] Distignuish between commit id and key in commit cache","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2007-03-12T17:51:15Z","receivedAt":"2007-03-12T17:51:15Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"See WeakHashMap documentation. If the key is the same object\nas the objectid the keys can never be collected.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n\n .../src/org/spearce/jgit/lib/Repository.java       |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java\nindex f7c470d..8b1f42c 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java\n@@ -199,7 +199,9 @@ public class Repository {\n \t\tfinal byte[] raw = or.getBytes();\n \t\tif (Constants.TYPE_COMMIT.equals(or.getType())) {\n \t\t\tret = new Commit(this, id, raw);\n-\t\t\tcache.put(id, ret);\n+\t\t\t// The key must not be the referenced strongly\n+\t\t\t// by the value in WeakHashMaps\n+\t\t\tcache.put(new ObjectId(id.getBytes()), ret);\n \t\t\treturn ret;\n \t\t}\n \t\tthrow new IncorrectObjectTypeException(id, Constants.TYPE_COMMIT);\n"},{"id":"36960","messageId":"20070312210540.GA16513@spearce.org","threadId":"7210","inReplyTo":"20070312175115.10884.87646.stgit@lathund.dewire.com","subject":"Re: [PATCH] Distignuish between commit id and key in commit cache","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-03-12T21:05:40Z","receivedAt":"2007-03-12T21:05:40Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Robin Rosenberg <robin.rosenberg@dewire.com> wrote:\n> See WeakHashMap documentation. If the key is the same object\n> as the objectid the keys can never be collected.\n\nThanks.  I have applied this in the middle of your other recent\nseries, tagged 0.2.1 and pushed it out to the usual locations.\nThe history view looks pretty nice...  and is reasonably quick too!\n\n-- \nShawn.\n"}]}