]> source.dussan.org Git - jgit.git/commitdiff
Peel tags during resolve of foo^ 96/9596/1
authorDave Borowitz <dborowitz@google.com>
Thu, 10 Jan 2013 18:53:54 +0000 (10:53 -0800)
committerDave Borowitz <dborowitz@google.com>
Thu, 10 Jan 2013 18:56:37 +0000 (10:56 -0800)
Once we start talking about parents of tags, we are in the commit
graph, so treat all objects from this point as commits. This fixes
spurious IncorrectObjectTypeExceptions on resolving expressions like
tag^^.

Change-Id: I29ece1fdb49c9c5b9ca415efcd1876bc72e97120

org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

index 91364ce98432077355287f0aee9c12106a9df7d6..12b9dc94cc0fc854d4fe9ca9a991862716f8e3d6 100644 (file)
@@ -178,9 +178,11 @@ public class RepositoryResolveTest extends SampleDataRepositoryTestCase {
                assertEquals("d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864",db.resolve("refs/tags/B10th^0").name());
                assertEquals("d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864",db.resolve("refs/tags/B10th~0").name());
                assertEquals("0966a434eb1a025db6b71485ab63a3bfbea520b6",db.resolve("refs/tags/B10th^").name());
+               assertEquals("2c349335b7f797072cf729c4f3bb0914ecb6dec9",db.resolve("refs/tags/B10th^^").name());
                assertEquals("0966a434eb1a025db6b71485ab63a3bfbea520b6",db.resolve("refs/tags/B10th^1").name());
                assertEquals("0966a434eb1a025db6b71485ab63a3bfbea520b6",db.resolve("refs/tags/B10th~1").name());
                assertEquals("2c349335b7f797072cf729c4f3bb0914ecb6dec9",db.resolve("refs/tags/B10th~2").name());
+               assertEquals("2c349335b7f797072cf729c4f3bb0914ecb6dec9",db.resolve("refs/tags/B10th^~1").name());
        }
 
        @Test
index 75053796b53a9ee895c5a8902456ac3e75b0b553..b36f7e87b2915a44634e07091208f4eba2d4fd7e 100644 (file)
@@ -509,7 +509,7 @@ public abstract class Repository {
                                                done = k;
                                                break;
                                        default:
-                                               rev = rw.parseAny(rev);
+                                               rev = rw.peel(rev);
                                                if (rev instanceof RevCommit) {
                                                        RevCommit commit = ((RevCommit) rev);
                                                        if (commit.getParentCount() == 0)