diff options
author | Dave Borowitz <dborowitz@google.com> | 2013-01-10 10:53:54 -0800 |
---|---|---|
committer | Dave Borowitz <dborowitz@google.com> | 2013-01-10 10:56:37 -0800 |
commit | 891a2d75e7820e8f18e963e44a4b93ecad49c421 (patch) | |
tree | b100878ce225976f095c53cf834a42a5cb609fd0 | |
parent | 4407423d29d3e3b235753f638a1fdf0b553fa64e (diff) | |
download | jgit-891a2d75e7820e8f18e963e44a4b93ecad49c421.tar.gz jgit-891a2d75e7820e8f18e963e44a4b93ecad49c421.zip |
Peel tags during resolve of foo^
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
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java | 2 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java index 91364ce984..12b9dc94cc 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java @@ -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 diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 75053796b5..b36f7e87b2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -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) |