{"thread":{"id":"15493","subject":"[JGIT PATCH 1/2] Issue 23: Resolve tag^0 as tag^{commit}","startedAt":"2008-09-11T21:39:27Z","lastAt":"2008-09-12T14:47:09Z","messageCount":10,"participants":["Jonas Fonseca","Robin Rosenberg","Imran M Yousuf","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"90481","messageId":"20080911213927.GA20238@diku.dk","threadId":"15493","inReplyTo":null,"subject":"[JGIT PATCH 1/2] Issue 23: Resolve tag^0 as tag^{commit}","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2008-09-11T21:39:27Z","receivedAt":"2008-09-11T21:39:27Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Repository.resolve(\"tag^0\") failed with \"not a commit\". Fix it and add a\ntest case for it.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n .../org/spearce/jgit/lib/T0008_testparserev.java   |    9 ++++++++-\n .../src/org/spearce/jgit/lib/Repository.java       |    5 +++++\n 2 files changed, 13 insertions(+), 1 deletions(-)\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\nindex 8883b8b..3457574 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n@@ -109,10 +109,17 @@ public void testDerefTag() throws IOException {\n \t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"spearce-gpg-pub^{blob}\").name());\n \t}\n \n+\tpublic void testDerefTagIssue23() throws IOException {\n+\t\tassertEquals(\"17768080a2318cd89bba4c8b87834401e2095703\",db.resolve(\"refs/tags/B\").name());\n+\t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/B^{commit}\").name());\n+\t\t// The special tag^0 == tag^{commit} rule\n+\t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/B^0\").name());\n+\t}\n+\n \tpublic void testDerefBlob() throws IOException {\n \t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7^{}\").name());\n \t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7^{blob}\").name());\n \t}\n-\t\n+\n \t// TODO: ^{tree} for a tag pointing to a tag\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 b27c23d..260a39d 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@@ -562,6 +562,11 @@ public ObjectId resolve(final String revstr) throws IOException {\n \t\t\t\t\tcase '9':\n \t\t\t\t\t\tint j;\n \t\t\t\t\t\tref = mapObject(refId, null);\n+\t\t\t\t\t\tif (ref instanceof Tag && rev[i + 1] == '0') {\n+\t\t\t\t\t\t\tTag tag = (Tag)ref;\n+\t\t\t\t\t\t\trefId = tag.getObjId();\n+\t\t\t\t\t\t\tref = mapObject(refId, null);\n+\t\t\t\t\t\t}\n \t\t\t\t\t\tif (!(ref instanceof Commit))\n \t\t\t\t\t\t\tthrow new IncorrectObjectTypeException(refId, Constants.TYPE_COMMIT);\n \t\t\t\t\t\tfor (j=i+1; j<rev.length; ++j) {\n-- \n1.6.0.336.ga07ba\n\n\n-- \nJonas Fonseca\n"},{"id":"90490","messageId":"200809120047.58484.robin.rosenberg.lists@dewire.com","threadId":"15493","inReplyTo":"20080911213927.GA20238@diku.dk","subject":"Re: [JGIT PATCH 1/2] Issue 23: Resolve tag^0 as tag^{commit}","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-09-11T22:47:58Z","receivedAt":"2008-09-11T22:47:58Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"torsdagen den 11 september 2008 23.39.27 skrev Jonas Fonseca:\n> Repository.resolve(\"tag^0\") failed with \"not a commit\". Fix it and add a\n> test case for it.\n\nIt seems this case is not *that* special. It is tag^N == tag^{commit}^N\nSame for tag~N == tag^{commit}~N-\n\nMy fault, i guess, but it would be nice of you fixed it while you are at it.\n\nSecond, the testcase in the second patch fails on my machine.\n\ntestDerefTaggedTagTree(org.spearce.jgit.lib.T0008_testparserev)\njunit.framework.ComparisonFailure: expected:<[269e1253bad5c247c6bde37aa48ae1e03138206c]> but was:<[be83157b4ffe650d728ba4f98ad47b623b0d0c20]>\n\tat junit.framework.Assert.assertEquals(Assert.java:81)\n\tat junit.framework.Assert.assertEquals(Assert.java:87)\n\tat org.spearce.jgit.lib.T0008_testparserev.testDerefTaggedTagTree(T0008_testparserev.java:123)\n\n-- robin\n"},{"id":"90504","messageId":"20080912000007.GA31931@diku.dk","threadId":"15493","inReplyTo":"200809120047.58484.robin.rosenberg.lists@dewire.com","subject":"Re: [JGIT PATCH 1/2] Issue 23: Resolve tag^0 as tag^{commit}","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2008-09-12T00:00:07Z","receivedAt":"2008-09-12T00:00:07Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote Fri, Sep 12, 2008:\n> torsdagen den 11 september 2008 23.39.27 skrev Jonas Fonseca:\n> > Repository.resolve(\"tag^0\") failed with \"not a commit\". Fix it and add a\n> > test case for it.\n> \n> It seems this case is not *that* special. It is tag^N == tag^{commit}^N\n> Same for tag~N == tag^{commit}~N-\n \ngit-rev-parse(1) says:\n\n · A suffix ^ to a revision parameter means the first parent of that\n   commit object.  ^<n> means the <n>th parent (i.e.  rev^ is\n   equivalent to rev^1). As a special rule, rev^0 means the commit\n   itself and is used when rev is the object name of a tag object that\n   refers to a commit object.\n\nbut does take tag^1, however not tag^2. It looks like tag~N is broken in\nJGit (\"not a commit\") so should also be fixed if we want to be\ncompatible with git-rev-parse.\n\nBTW, I just noticed that ^{} is not handled correctly either for tags.\n\n · A suffix ^ followed by an empty brace pair (e.g.  v0.99.8^{}) means\n   the object could be a tag, and dereference the tag recursively\n   until a non-tag object is found.\n\nOnly one derefence is performed.\n\n> My fault, i guess, but it would be nice of you fixed it while you are at it.\n\nI will try to make fixes for the above cases tomorrow.\n\n> Second, the testcase in the second patch fails on my machine.\n> \n> testDerefTaggedTagTree(org.spearce.jgit.lib.T0008_testparserev)\n> junit.framework.ComparisonFailure: expected:<[269e1253bad5c247c6bde37aa48ae1e03138206c]> but was:<[be83157b4ffe650d728ba4f98ad47b623b0d0c20]>\n> \tat junit.framework.Assert.assertEquals(Assert.java:81)\n> \tat junit.framework.Assert.assertEquals(Assert.java:87)\n> \tat org.spearce.jgit.lib.T0008_testparserev.testDerefTaggedTagTree(T0008_testparserev.java:123)\n\nI reran all the test before formatting the patch, but after doing some\nlast minut changes. When I run all the tests using maven (inside\nNetBeans or from the command line) it tells me:\n\n\tTests run: 428, Failures: 0, Errors: 0, Skipped: 0\n\nFrom the output it looks like the tests in the files named T000* are\nnever run. However, where the breakage is (could be my setup) I don't\nknow. Imran?\n\nAnyway, for now I will just run the single test specifically. Perhaps I\nshould just put this into the same patch. Anyway, the following should\nfix it.\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\nindex 2a1a4ad..1fc73b4 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n@@ -117,7 +117,7 @@ public void testDerefTagIssue23() throws IOException {\n \t}\n \n \tpublic void testDerefTaggedTagTree() throws IOException {\n-\t\tassertEquals(\"269e1253bad5c247c6bde37aa48ae1e03138206c\",db.resolve(\"refs/tags/C\").name());\n+\t\tassertEquals(\"be83157b4ffe650d728ba4f98ad47b623b0d0c20\",db.resolve(\"refs/tags/C\").name());\n \t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/C^{commit}\").name());\n \t\tassertEquals(\"856ec208ae6cadac25a6d74f19b12bb27a24fe24\",db.resolve(\"refs/tags/C^{tree}\").name());\n \t}\n\n-- \nJonas Fonseca\n"},{"id":"90509","messageId":"9e85b2570809111851y756fdb3en2c17c69bf5ac444e@mail.gmail.com","threadId":"15493","inReplyTo":"20080912000007.GA31931@diku.dk","subject":"Re: [JGIT PATCH 1/2] Issue 23: Resolve tag^0 as tag^{commit}","fromName":"Imran M Yousuf","fromEmail":"imran@smartitengineering.com","sentAt":"2008-09-12T01:51:05Z","receivedAt":"2008-09-12T01:51:05Z","isPatch":true,"sender":{"key":"imran@smartitengineering.com","avatar":"https://gravatar.com/avatar/a9c5dcee49ab153a94c6fc26c5a1e6efe93261425b46f69ccfb8e0a151aa8a60?d=mp&s=160"},"body":"On Fri, Sep 12, 2008 at 6:00 AM, Jonas Fonseca <fonseca@diku.dk> wrote:\n>> Second, the testcase in the second patch fails on my machine.\n>>\n>> testDerefTaggedTagTree(org.spearce.jgit.lib.T0008_testparserev)\n>> junit.framework.ComparisonFailure: expected:<[269e1253bad5c247c6bde37aa48ae1e03138206c]> but was:<[be83157b4ffe650d728ba4f98ad47b623b0d0c20]>\n>>       at junit.framework.Assert.assertEquals(Assert.java:81)\n>>       at junit.framework.Assert.assertEquals(Assert.java:87)\n>>       at org.spearce.jgit.lib.T0008_testparserev.testDerefTaggedTagTree(T0008_testparserev.java:123)\n>\n> I reran all the test before formatting the patch, but after doing some\n> last minut changes. When I run all the tests using maven (inside\n> NetBeans or from the command line) it tells me:\n>\n>        Tests run: 428, Failures: 0, Errors: 0, Skipped: 0\n>\n> From the output it looks like the tests in the files named T000* are\n> never run. However, where the breakage is (could be my setup) I don't\n> know. Imran?\n>\n\nHmm, I will have to check it. Will come back with some feedback after\nchecking. Usually if a class is a TestCase then it should have run.\n\n> Anyway, for now I will just run the single test specifically. Perhaps I\n> should just put this into the same patch. Anyway, the following should\n> fix it.\n>\n> diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n> index 2a1a4ad..1fc73b4 100644\n> --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n> +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n> @@ -117,7 +117,7 @@ public void testDerefTagIssue23() throws IOException {\n>        }\n>\n>        public void testDerefTaggedTagTree() throws IOException {\n> -               assertEquals(\"269e1253bad5c247c6bde37aa48ae1e03138206c\",db.resolve(\"refs/tags/C\").name());\n> +               assertEquals(\"be83157b4ffe650d728ba4f98ad47b623b0d0c20\",db.resolve(\"refs/tags/C\").name());\n>                assertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/C^{commit}\").name());\n>                assertEquals(\"856ec208ae6cadac25a6d74f19b12bb27a24fe24\",db.resolve(\"refs/tags/C^{tree}\").name());\n>        }\n>\n> --\n> Jonas Fonseca\n>\n\n\n\n-- \nImran M Yousuf\nEntrepreneur & Software Engineer\nSmart IT Engineering\nDhaka, Bangladesh\nEmail: imran@smartitengineering.com\nBlog: http://imyousuf-tech.blogs.smartitengineering.com/\nMobile: +880-1711402557\n"},{"id":"90518","messageId":"200809120847.13541.robin.rosenberg.lists@dewire.com","threadId":"15493","inReplyTo":"20080912000007.GA31931@diku.dk","subject":"Re: [JGIT PATCH 1/2] Issue 23: Resolve tag^0 as tag^{commit}","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-09-12T06:47:13Z","receivedAt":"2008-09-12T06:47:13Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"fredagen den 12 september 2008 02.00.07 skrev Jonas Fonseca:\n> Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote Fri, Sep 12, 2008:\n> > torsdagen den 11 september 2008 23.39.27 skrev Jonas Fonseca:\n> > > Repository.resolve(\"tag^0\") failed with \"not a commit\". Fix it and add a\n> > > test case for it.\n> > \n> > It seems this case is not *that* special. It is tag^N == tag^{commit}^N\n> > Same for tag~N == tag^{commit}~N-\n>  \n> git-rev-parse(1) says:\n> \n>  · A suffix ^ to a revision parameter means the first parent of that\n>    commit object.  ^<n> means the <n>th parent (i.e.  rev^ is\n>    equivalent to rev^1). As a special rule, rev^0 means the commit\n>    itself and is used when rev is the object name of a tag object that\n>    refers to a commit object.\n> \n> but does take tag^1, however not tag^2. It looks like tag~N is broken in\ntag^2 means you have a merge commit. I think rev^0 is mentioned here\nto mean that it is actually defined (and how).\n\n> JGit (\"not a commit\") so should also be fixed if we want to be\n> compatible with git-rev-parse.\n> \n> BTW, I just noticed that ^{} is not handled correctly either for tags.\n>  · A suffix ^ followed by an empty brace pair (e.g.  v0.99.8^{}) means\n>    the object could be a tag, and dereference the tag recursively\n>    until a non-tag object is found.\n> \n> Only one derefence is performed.\nGood catch!\n\n> > My fault, i guess, but it would be nice of you fixed it while you are at it.\n> \n> I will try to make fixes for the above cases tomorrow.\n> \n> > Second, the testcase in the second patch fails on my machine.\n> > \n> > testDerefTaggedTagTree(org.spearce.jgit.lib.T0008_testparserev)\n> > junit.framework.ComparisonFailure: expected:<[269e1253bad5c247c6bde37aa48ae1e03138206c]> but was:<[be83157b4ffe650d728ba4f98ad47b623b0d0c20]>\n> > \tat junit.framework.Assert.assertEquals(Assert.java:81)\n> > \tat junit.framework.Assert.assertEquals(Assert.java:87)\n> > \tat org.spearce.jgit.lib.T0008_testparserev.testDerefTaggedTagTree(T0008_testparserev.java:123)\n> \n> I reran all the test before formatting the patch, but after doing some\n> last minut changes. When I run all the tests using maven (inside\n> NetBeans or from the command line) it tells me:\n> \n> \tTests run: 428, Failures: 0, Errors: 0, Skipped: 0\n> \n> From the output it looks like the tests in the files named T000* are\n> never run. However, where the breakage is (could be my setup) I don't\n> know. Imran?\n> \n> Anyway, for now I will just run the single test specifically. Perhaps I\n> should just put this into the same patch. Anyway, the following should\n> fix it.\nYes, please resubmit after updating the rev-parsing code.\n\n> diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n> index 2a1a4ad..1fc73b4 100644\n> --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n> +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n> @@ -117,7 +117,7 @@ public void testDerefTagIssue23() throws IOException {\n>  \t}\n>  \n>  \tpublic void testDerefTaggedTagTree() throws IOException {\n> -\t\tassertEquals(\"269e1253bad5c247c6bde37aa48ae1e03138206c\",db.resolve(\"refs/tags/C\").name());\n> +\t\tassertEquals(\"be83157b4ffe650d728ba4f98ad47b623b0d0c20\",db.resolve(\"refs/tags/C\").name());\n>  \t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/C^{commit}\").name());\n>  \t\tassertEquals(\"856ec208ae6cadac25a6d74f19b12bb27a24fe24\",db.resolve(\"refs/tags/C^{tree}\").name());\n>  \t}\n> \nMy guess is you added to original test tag C manually so it got an \"non-deterministic\" time stamp.\n\n-- robin\n"},{"id":"90522","messageId":"20080912084030.GA4964@diku.dk","threadId":"15493","inReplyTo":"9e85b2570809111851y756fdb3en2c17c69bf5ac444e@mail.gmail.com","subject":"[JGIT PATCH] Configure the maven surefire plugin to specifically include all tests","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2008-09-12T08:40:30Z","receivedAt":"2008-09-12T08:40:30Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"By default, the test cases named T000* were not included. With this\npatch maven reports that 508 tests have been run.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n jgit-maven/jgit/pom.xml |   11 +++++++++++\n 1 files changed, 11 insertions(+), 0 deletions(-)\n\n Imran M Yousuf <imran@smartitengineering.com> wrote Fri, Sep 12, 2008:\n > On Fri, Sep 12, 2008 at 6:00 AM, Jonas Fonseca <fonseca@diku.dk> wrote:\n > > When I run all the tests using maven (inside\n > > NetBeans or from the command line) it tells me:\n > >\n > >        Tests run: 428, Failures: 0, Errors: 0, Skipped: 0\n > >\n > > From the output it looks like the tests in the files named T000* are\n > > never run. However, where the breakage is (could be my setup) I don't\n > > know. Imran?\n > >\n > \n > Hmm, I will have to check it. Will come back with some feedback after\n > checking. Usually if a class is a TestCase then it should have run.\n \n I started looking for possible bug reports at jira.codehaus.org and\n found an issue for extendeding the default path patterns used for\n including and excluding tests. Maybe something like this patch is clean\n enough, at least it increases \"my coverage\" to 508 tests.\n\ndiff --git a/jgit-maven/jgit/pom.xml b/jgit-maven/jgit/pom.xml\nindex a64f53c..a123470 100644\n--- a/jgit-maven/jgit/pom.xml\n+++ b/jgit-maven/jgit/pom.xml\n@@ -158,6 +158,17 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n                     <encoding>UTF-8</encoding>\n                 </configuration>\n             </plugin>\n+            <plugin>\n+                <artifactId>maven-surefire-plugin</artifactId>\n+                <version>2.4.2</version>\n+                <configuration>\n+                    <includes>\n+                        <include>**/*Test.java</include>\n+                        <include>**/*TestCase.java</include>\n+                        <include>**/T000*.java</include>\n+                    </includes>\n+                </configuration>\n+           </plugin>\n         </plugins>\n     </build>\n     <dependencies>\n-- \n1.6.0.1.451.gc8d31\n\n-- \nJonas Fonseca\n"},{"id":"90537","messageId":"20080912105703.GA7945@diku.dk","threadId":"15493","inReplyTo":"200809120847.13541.robin.rosenberg.lists@dewire.com","subject":"[JGIT PATCH 1/3] Fix IncorrectObjectTypeException thrown for incorrect ^{blob}","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2008-09-12T10:57:04Z","receivedAt":"2008-09-12T10:57:04Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n .../src/org/spearce/jgit/lib/Repository.java       |    2 +-\n 1 files changed, 1 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 b27c23d..730a267 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@@ -628,7 +628,7 @@ else if (item.equals(\"blob\")) {\n \t\t\t\t\t\t\t\t\tref = mapObject(refId, null);\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\tif (!(ref instanceof byte[]))\n-\t\t\t\t\t\t\t\t\tthrow new IncorrectObjectTypeException(refId,  Constants.TYPE_COMMIT);\n+\t\t\t\t\t\t\t\t\tthrow new IncorrectObjectTypeException(refId,  Constants.TYPE_BLOB);\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\telse if (item.equals(\"\")) {\n \t\t\t\t\t\t\t\tref = mapObject(refId, null);\n-- \n1.6.0.1.451.gc8d31\n\n-- \nJonas Fonseca\n"},{"id":"90538","messageId":"20080912105729.GB7945@diku.dk","threadId":"15493","inReplyTo":"200809120847.13541.robin.rosenberg.lists@dewire.com","subject":"[JGIT PATCH 2/3] Fix off by one distance during resolving of commit~N","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2008-09-12T10:57:29Z","receivedAt":"2008-09-12T10:57:29Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"To be compatible with git-rev-parse, commit~0 should resolve to commit,\ncommit~1 to commit^, etc.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n .../org/spearce/jgit/lib/T0008_testparserev.java   |    9 +++++----\n .../src/org/spearce/jgit/lib/Repository.java       |    2 +-\n 2 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\nindex 8883b8b..506f51f 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n@@ -82,10 +82,11 @@ public void testRef_refname() throws IOException {\n \t}\n \n \tpublic void testDistance() throws IOException {\n-\t\tassertEquals(\"6e1475206e57110fcef4b92320436c1e9872a322\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~0\").name());\n-\t\tassertEquals(\"1203b03dc816ccbb67773f28b3c19318654b0bc8\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~1\").name());\n-\t\tassertEquals(\"bab66b48f836ed950c99134ef666436fb07a09a0\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~2\").name());\n-\t\tassertEquals(\"bab66b48f836ed950c99134ef666436fb07a09a0\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~02\").name());\n+\t\tassertEquals(\"49322bb17d3acc9146f98c97d078513228bbf3c0\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~0\").name());\n+\t\tassertEquals(\"6e1475206e57110fcef4b92320436c1e9872a322\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~1\").name());\n+\t\tassertEquals(\"1203b03dc816ccbb67773f28b3c19318654b0bc8\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~2\").name());\n+\t\tassertEquals(\"bab66b48f836ed950c99134ef666436fb07a09a0\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~3\").name());\n+\t\tassertEquals(\"bab66b48f836ed950c99134ef666436fb07a09a0\",db.resolve(\"49322bb17d3acc9146f98c97d078513228bbf3c0~03\").name());\n \t}\n \n \tpublic void testTree() throws IOException {\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 730a267..894fe3b 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@@ -688,7 +688,7 @@ else if (item.equals(\"\")) {\n \t\t\t\t\tthrow new RevisionSyntaxException(\n \t\t\t\t\t\t\t\"Invalid ancestry length\", revstr);\n \t\t\t\t}\n-\t\t\t\twhile (dist >= 0) {\n+\t\t\t\twhile (dist > 0) {\n \t\t\t\t\tfinal ObjectId[] parents = ((Commit) ref).getParentIds();\n \t\t\t\t\tif (parents.length == 0) {\n \t\t\t\t\t\trefId = null;\n-- \n1.6.0.1.451.gc8d31\n\n-- \nJonas Fonseca\n"},{"id":"90539","messageId":"20080912105750.GC7945@diku.dk","threadId":"15493","inReplyTo":"200809120847.13541.robin.rosenberg.lists@dewire.com","subject":"[JGIT PATCH 3/3] Tests and fixes for dereferencing tags in Repository.resolve()","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2008-09-12T10:57:50Z","receivedAt":"2008-09-12T10:57:50Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Fix Repository.resolve(\"tag^0\") failing with \"not a commit\" (issue 23).\nAdd test for resolving \"tag^{tree}\" where \"tag\" points to a tag\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n .../spearce/jgit/test/resources/create-second-pack |    8 +++++\n ...ck-546ff360fe3488adb20860ce3436a2d6373d2796.idx |  Bin 0 -> 1324 bytes\n ...k-546ff360fe3488adb20860ce3436a2d6373d2796.pack |  Bin 0 -> 1265 bytes\n .../org/spearce/jgit/test/resources/packed-refs    |   18 ++++++++++++\n .../org/spearce/jgit/lib/RepositoryTestCase.java   |    1 +\n .../org/spearce/jgit/lib/T0008_testparserev.java   |   24 +++++++++++++---\n .../src/org/spearce/jgit/lib/Repository.java       |   29 ++++++++++++++++---\n 7 files changed, 71 insertions(+), 9 deletions(-)\n create mode 100755 org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-546ff360fe3488adb20860ce3436a2d6373d2796.idx\n create mode 100755 org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-546ff360fe3488adb20860ce3436a2d6373d2796.pack\n\ndiff --git a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/create-second-pack b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/create-second-pack\nindex 03f83dc..052877d 100755\n--- a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/create-second-pack\n+++ b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/create-second-pack\n@@ -130,6 +130,14 @@ git tag -a -m \"An annotated tag\" B a^\n \n git repack -d\n \n+Bnth=B\n+for nth in 2nd 3rd 4th 5th 6th 7th 8th 9th 10th; do\n+\tgit tag -a -m \"An $nth level annotated tag\" \"B$nth\" \"$Bnth\"\n+\tBnth=\"B$nth\"\n+done\n+\n+git repack -d\n+\n git pack-refs --all\n \n \ndiff --git a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-546ff360fe3488adb20860ce3436a2d6373d2796.idx b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-546ff360fe3488adb20860ce3436a2d6373d2796.idx\nnew file mode 100755\nindex 0000000000000000000000000000000000000000..60331335d9bfa0a1830b707a36648bef5c434de9\nGIT binary patch\nliteral 1324\nzcmexg;-AdGz`z8=$bb>ZAqRuZp#(Dn^^fAA69z26_@W191=>SP%my@{7MLAqE<Vfw\nzl&1#f1e!w;X4YY|dF;|=I?wL$m7h-!sqTEZ<d9&&_9~CduXH0eIHz>W9kWfyv-_p!\nzv#wIbI9*p`^SYhiW29dAUv<;y{p*xDuUg<~#xJ>b`&8x`zwBKhx4ihQ?%X{KcsVL<\nz*YFlFEt$`vabSO-^6v8ETNhV;zc)u{a%i8O%KaTz{TT9gzn`-G^3t<m7ehWi`_T7$\nz%3Tq!Pi?N+f3xHkX!Dx8?ztTrH~0O!2|ktHQ>@q~%ak20yBn$`^kUD!HJ!YI+u~xG\nz#9o?rd|dq5SNQJQ6X*6S#cq>&Bkj`oHC|ie7cg9SfZ6FZFqwt|X-8nOwhV~nfyI;o\nzP;MHK-r4$UqjsNj$nyU7-?sZdXU_VTp1EB`)i!yC7FVXKnZSo5`dp8Uf9ZS%0H$+^\nA0RR91\n\nliteral 0\nHcmV?d00001\n\ndiff --git a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-546ff360fe3488adb20860ce3436a2d6373d2796.pack b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-546ff360fe3488adb20860ce3436a2d6373d2796.pack\nnew file mode 100755\nindex 0000000000000000000000000000000000000000..203c157657b7f48faaaf23b794ce68264f3fd6a8\nGIT binary patch\nliteral 1265\nzcmV<N1P=R9K|@Ob00062000Td33!|x%uNo0Kny_P{hXo~kWA+XBr!xhgC3wm3&a3J\nzNHuzU!Np6y)ywHAodPq4K)pMcA-dFaNhoApvh1r6Q^zUBC^Z}Xt^!Jf*@GKe9S;q%\nzK?@JKk9mU&6|X{fUFAdbI!V#xxdB9UHG1?OPPVevn0A3<0F%6B0$P@=q{9FG57Q|w\nz8^#HEoE?l?4#FT10RK6~UO)m}2_-ScdImiJkEM;F&@`*j+lzioGCwmdJSZ}RZ1jL3\nzSQ~9H9<9qZk&Ak8Xv|1R!!hMB3jS;a>}Sz|tK;P-Gwm?J9d1k8;pF90a<>b;{kj#B\nzv8`v&y1z7PL^vp`ln_&e-b0}m74Wq-_DtzN{{n1~EsMqpc$^)KK?=e!5CHFa#eTrD\nzNeXE|#QFw(z&5+KNSc(givHf{VPGyZb$Uorpb&gw$C0N*h>Syso+%**L`QwRWABE9\nzMn9W?(rg-V8Fcx{EIW*FgX>avI8yiQwAoqSv~F3tRM!(&YhAS7dJhL|Q)9*gt%ocx\nz$v~x4B^Cb9zhPJ{V8#h}oE?lo4uUWg1@}G0zksCQwjhZi;u-V+Eq#R;XbJfmy}jsS\nzlG)6Z@W3DxorTslLO^P5Xrl3Mh^~(8Y+}?&pO8Xpm3&r^_)+c9wUOy3BR1;kPPeIS\nzboSM=lHD$N`(>R`4Q1(wnU5_SHiizm(ORiK)85mJ7iRJ~7x9AlpML?Z4lWGF33!|x\nzj9UuAFc1L$bBeuyA)BWGDb_RS0n&7Bkv1u16}`RDkAeA_sl$UZ1Ko+DvN=RML~D}r\nz(O?cfyWq#sIjvFCama!{8v&<DG~nWS{>el;^l*dgTz5Dn`IOx3Oz*UA3&~v94iHgC\nzG-wPQR8UHYzCi0?p%*QXN~xTf#{c{aKCmqy#tC?w9gJNLf-n#U-+PL^fTT<LX%j=l\nzGw1;p`T;RO30aNaUi4v-d6`Mw1HF=uLoD(t1k@c{l$9TZA?T170nQ=#D4t>Tvw>7b\nzb3oTpr=N`2siiyJrnJ*pvS+4;UGSD=o00WtX^5Hgz>b}xldY{ard{diX~qjP$+{*L\nzMf}gdnE5T|#tC?w9gRT_!XOYu_ncxbAb}1-O^mUgK@Tv%*v7QbG^5emi!NUBHt+u$\nzADjfN4JL*_uFuHS<$WKGL+|=%IeE<9ct*aHlF!N@G^z$%oJ>C%d4mCNaGmM~N77F%\nz&CdL$Wt~~4x}4gB?G6?#BJ4~sMya7d>tW^>&p@SAA>sTV{{lSeEjGppc$^)KK@P$o\nz5CHGIVm}~ZSy~`5#`*?*z!tVOrY%i_Mt^VhFv(nIO8<~l!J<nnK3YfAdYf(NiKUN&\nzZxXTuH{`~(HmLep1uBnf2QIYbpNz6W2RFFh%LYf*PhEFA%bVwQ5}nF?0z|YC35nof\nzyfI333+z2i@{$R7SxV(9`9J>xFz+o1#tC?w9gIN=!Y~j3?|H?3z_OcEvjq|B8}tF2\nzWT{A-loCaMZ}c!QmzfeC8Y__Z2S!G*jyNVBLXbXkV9&1ak<{X__vlRhtO`{o(}0W3\nz=_iwJFv1P4_p-rJx@T9Lo%JotI%^lpasnc<137XIcIXj}88fsVW_{@ll5?q2HT~yb\nby>=`Kh3c^@jzd(ZkB9p`zw>FD_Gf9gVWLq?\n\nliteral 0\nHcmV?d00001\n\ndiff --git a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/packed-refs b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/packed-refs\nindex f67a3ef..746bd6b 100644\n--- a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/packed-refs\n+++ b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/packed-refs\n@@ -9,5 +9,23 @@ d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864 refs/heads/pa\n 6db9c2ebf75590eef973081736730a9ea169a0c4 refs/tags/A\n 17768080a2318cd89bba4c8b87834401e2095703 refs/tags/B\n ^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+032c063ce34486359e3ee3d4f9e5c225b9e1a4c2 refs/tags/B10th\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+214cae792433672d28b3aeb9f75c1ae84fd54628 refs/tags/B2nd\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+1170b77a48d3ea2d58b043648b1ec63d606e3efa refs/tags/B3rd\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+8dfd42699e7b10e568fa1eaebe249e33e98da81e refs/tags/B4th\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+efee904c794b943a06931c76c576dd552212e8bc refs/tags/B5th\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+d54e006ebbef94b7d3a5cd56d154f1e6f08efb94 refs/tags/B6th\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+a773cd2d9dbca00d08793dac0d7002a49f0428c0 refs/tags/B7th\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+bf5123bb77c7b5a379f7de9c1293558e3e24dfb8 refs/tags/B8th\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n+dd144af286452bfd6a1ea02b0d3745bcdb555e9d refs/tags/B9th\n+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\n 8bbde7aacf771a9afb6992434f1ae413e010c6d8 refs/tags/spearce-gpg-pub\n ^fd608fbe625a2b456d9f15c2b1dc41f252057dd7\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java\nindex 270b90a..9d7d133 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java\n@@ -141,6 +141,7 @@ public void run() {\n \t\t\t\t\"pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f\",\n \t\t\t\t\"pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371\",\n \t\t\t\t\"pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745\",\n+\t\t\t\t\"pack-546ff360fe3488adb20860ce3436a2d6373d2796\",\n \t\t\t\t\"pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa\"\n \t\t};\n \t\tfinal File packDir = new File(db.getObjectsDirectory(), \"pack\");\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\nindex 506f51f..47105cf 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java\n@@ -106,14 +106,30 @@ public void testDerefCommit() throws IOException {\n \t}\n \n \tpublic void testDerefTag() throws IOException {\n-\t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"spearce-gpg-pub^{}\").name());\n-\t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"spearce-gpg-pub^{blob}\").name());\n+\t\tassertEquals(\"17768080a2318cd89bba4c8b87834401e2095703\",db.resolve(\"refs/tags/B\").name());\n+\t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/B^{commit}\").name());\n+\t\tassertEquals(\"032c063ce34486359e3ee3d4f9e5c225b9e1a4c2\",db.resolve(\"refs/tags/B10th\").name());\n+\t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/B10th^{commit}\").name());\n+\t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/B10th^{}\").name());\n+\t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/B10th^0\").name());\n+\t\tassertEquals(\"d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\",db.resolve(\"refs/tags/B10th~0\").name());\n+\t\tassertEquals(\"0966a434eb1a025db6b71485ab63a3bfbea520b6\",db.resolve(\"refs/tags/B10th^\").name());\n+\t\tassertEquals(\"0966a434eb1a025db6b71485ab63a3bfbea520b6\",db.resolve(\"refs/tags/B10th^1\").name());\n+\t\tassertEquals(\"0966a434eb1a025db6b71485ab63a3bfbea520b6\",db.resolve(\"refs/tags/B10th~1\").name());\n+\t\tassertEquals(\"2c349335b7f797072cf729c4f3bb0914ecb6dec9\",db.resolve(\"refs/tags/B10th~2\").name());\n \t}\n \n \tpublic void testDerefBlob() throws IOException {\n+\t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"spearce-gpg-pub^{}\").name());\n+\t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"spearce-gpg-pub^{blob}\").name());\n \t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7^{}\").name());\n \t\tassertEquals(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7\",db.resolve(\"fd608fbe625a2b456d9f15c2b1dc41f252057dd7^{blob}\").name());\n \t}\n-\t\n-\t// TODO: ^{tree} for a tag pointing to a tag\n+\n+\tpublic void testDerefTree() throws IOException {\n+\t\tassertEquals(\"032c063ce34486359e3ee3d4f9e5c225b9e1a4c2\",db.resolve(\"refs/tags/B10th\").name());\n+\t\tassertEquals(\"856ec208ae6cadac25a6d74f19b12bb27a24fe24\",db.resolve(\"032c063ce34486359e3ee3d4f9e5c225b9e1a4c2^{tree}\").name());\n+\t\tassertEquals(\"856ec208ae6cadac25a6d74f19b12bb27a24fe24\",db.resolve(\"refs/tags/B10th^{tree}\").name());\n+\t}\n+\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 894fe3b..dfce1b8 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@@ -562,6 +562,11 @@ public ObjectId resolve(final String revstr) throws IOException {\n \t\t\t\t\tcase '9':\n \t\t\t\t\t\tint j;\n \t\t\t\t\t\tref = mapObject(refId, null);\n+\t\t\t\t\t\twhile (ref instanceof Tag) {\n+\t\t\t\t\t\t\tTag tag = (Tag)ref;\n+\t\t\t\t\t\t\trefId = tag.getObjId();\n+\t\t\t\t\t\t\tref = mapObject(refId, null);\n+\t\t\t\t\t\t}\n \t\t\t\t\t\tif (!(ref instanceof Commit))\n \t\t\t\t\t\t\tthrow new IncorrectObjectTypeException(refId, Constants.TYPE_COMMIT);\n \t\t\t\t\t\tfor (j=i+1; j<rev.length; ++j) {\n@@ -632,10 +637,10 @@ else if (item.equals(\"blob\")) {\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\telse if (item.equals(\"\")) {\n \t\t\t\t\t\t\t\tref = mapObject(refId, null);\n-\t\t\t\t\t\t\t\tif (ref instanceof Tag)\n-\t\t\t\t\t\t\t\t\trefId = ((Tag)ref).getObjId();\n-\t\t\t\t\t\t\t\telse {\n-\t\t\t\t\t\t\t\t\t// self\n+\t\t\t\t\t\t\t\twhile (ref instanceof Tag) {\n+\t\t\t\t\t\t\t\t\tTag t = (Tag)ref;\n+\t\t\t\t\t\t\t\t\trefId = t.getObjId();\n+\t\t\t\t\t\t\t\t\tref = mapObject(refId, null);\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\telse\n@@ -658,6 +663,11 @@ else if (item.equals(\"\")) {\n \t\t\t\t\t}\n \t\t\t\t} else {\n \t\t\t\t\tref = mapObject(refId, null);\n+\t\t\t\t\twhile (ref instanceof Tag) {\n+\t\t\t\t\t\tTag tag = (Tag)ref;\n+\t\t\t\t\t\trefId = tag.getObjId();\n+\t\t\t\t\t\tref = mapObject(refId, null);\n+\t\t\t\t\t}\n \t\t\t\t\tif (ref instanceof Commit) {\n \t\t\t\t\t\tfinal ObjectId parents[] = ((Commit) ref)\n \t\t\t\t\t\t\t\t.getParentIds();\n@@ -673,8 +683,17 @@ else if (item.equals(\"\")) {\n \t\t\t\tif (ref == null) {\n \t\t\t\t\tString refstr = new String(rev,0,i);\n \t\t\t\t\trefId = resolveSimple(refstr);\n-\t\t\t\t\tref = mapCommit(refId);\n+\t\t\t\t\tif (refId == null)\n+\t\t\t\t\t\treturn null;\n+\t\t\t\t\tref = mapObject(refId, null);\n+\t\t\t\t}\n+\t\t\t\twhile (ref instanceof Tag) {\n+\t\t\t\t\tTag tag = (Tag)ref;\n+\t\t\t\t\trefId = tag.getObjId();\n+\t\t\t\t\tref = mapObject(refId, null);\n \t\t\t\t}\n+\t\t\t\tif (!(ref instanceof Commit))\n+\t\t\t\t\tthrow new IncorrectObjectTypeException(refId, Constants.TYPE_COMMIT);\n \t\t\t\tint l;\n \t\t\t\tfor (l = i + 1; l < rev.length; ++l) {\n \t\t\t\t\tif (!Character.isDigit(rev[l]))\n-- \n1.6.0.1.451.gc8d31\n\n-- \nJonas Fonseca\n"},{"id":"90559","messageId":"20080912144709.GC22960@spearce.org","threadId":"15493","inReplyTo":"20080912084030.GA4964@diku.dk","subject":"Re: [JGIT PATCH] Configure the maven surefire plugin to specifically include all tests","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-12T14:47:09Z","receivedAt":"2008-09-12T14:47:09Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jonas Fonseca <fonseca@diku.dk> wrote:\n> By default, the test cases named T000* were not included. With this\n> patch maven reports that 508 tests have been run.\n\nThanks.  508 is the correct current number of tests.\n \n> +            <plugin>\n> +                <artifactId>maven-surefire-plugin</artifactId>\n> +                <version>2.4.2</version>\n> +                <configuration>\n> +                    <includes>\n> +                        <include>**/*Test.java</include>\n> +                        <include>**/*TestCase.java</include>\n> +                        <include>**/T000*.java</include>\n> +                    </includes>\n> +                </configuration>\n> +           </plugin>\n\n-- \nShawn.\n"}]}