]> source.dussan.org Git - jgit.git/commit
Remove unnecessary ObjectId.copy() calls 40/1340/1
authorShawn O. Pearce <spearce@spearce.org>
Thu, 19 Aug 2010 18:43:39 +0000 (11:43 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 19 Aug 2010 18:43:39 +0000 (11:43 -0700)
commitd0043e5d31e8b923884147ca1bab6e5416497323
treebfb41c0eaf4d6ae412d13b939e2e642e454e6ea5
parentb7388637d80b1a73bf617a3656caea80f5ac682f
Remove unnecessary ObjectId.copy() calls

When RevObject overrode equals() to provide only reference equality
we used to need to convert a RevObject into an ObjectId by copy()
just to use standard Java tools like JUnit assertEquals(), or to
use contains() or get() on standard java.util collection types.

Now that we have removed this override and made ObjectId's equals()
final (preventing any of this mess in the future), some copy()
calls are unnecessary.  Anytime the value is being used as an input
to a lookup routine, or to an equals, we can avoid the copy().

However we still want to use copy() anytime we are given an ObjectId
that may exist long-term, where we don't want the high cost of the
additional storage from a RevCommit extension.  So we can't remove
all uses of copy(), just some of them.

Change-Id: Ief275dace435c0ddfa362ac8e5d93558bc7e9fc3
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackRefFilterTest.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java