{"thread":{"id":"20555","subject":"[PATCH JGIT 5/5] Treat gitlink tree entries similar to symlink tree entries","startedAt":"2009-08-12T15:07:09Z","lastAt":"2009-08-12T17:30:16Z","messageCount":3,"participants":["Jonas Fonseca","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"120414","messageId":"1250089629-22547-1-git-send-email-fonseca@diku.dk","threadId":"20555","inReplyTo":null,"subject":"[PATCH JGIT 5/5] Treat gitlink tree entries similar to symlink tree entries","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2009-08-12T15:07:09Z","receivedAt":"2009-08-12T15:07:09Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Adds minimal support for gitlinks, based on the existing code for\nhandling symlinks. The goal is to avoid exceptions when reading trees\nwith gitlinks.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n .../jgit/errors/GitlinksNotSupportedException.java |   58 +++++++++++++\n .../src/org/spearce/jgit/lib/ForceModified.java    |    4 +\n .../src/org/spearce/jgit/lib/GitlinkTreeEntry.java |   85 ++++++++++++++++++++\n .../src/org/spearce/jgit/lib/TreeVisitor.java      |    8 ++\n .../src/org/spearce/jgit/lib/WriteTree.java        |    7 ++\n 5 files changed, 162 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit/src/org/spearce/jgit/errors/GitlinksNotSupportedException.java\n create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/errors/GitlinksNotSupportedException.java b/org.spearce.jgit/src/org/spearce/jgit/errors/GitlinksNotSupportedException.java\nnew file mode 100644\nindex 0000000..8f8883f\n--- /dev/null\n+++ b/org.spearce.jgit/src/org/spearce/jgit/errors/GitlinksNotSupportedException.java\n@@ -0,0 +1,58 @@\n+/*\n+ * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>\n+ * Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org>\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.errors;\n+\n+import java.io.IOException;\n+\n+/**\n+ * An exception thrown when a gitlink entry is found and cannot be\n+ * handled.\n+ */\n+public class GitlinksNotSupportedException extends IOException {\n+\tprivate static final long serialVersionUID = 1L;\n+\n+\t/**\n+\t * Construct a GitlinksNotSupportedException for the specified link\n+\t *\n+\t * @param s name of link in tree or workdir\n+\t */\n+\tpublic GitlinksNotSupportedException(final String s) {\n+\t\tsuper(s);\n+\t}\n+}\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ForceModified.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ForceModified.java\nindex 6d38068..9c94e13 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/ForceModified.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ForceModified.java\n@@ -61,4 +61,8 @@ public void visitSymlink(final SymlinkTreeEntry s) throws IOException {\n \t\t// Eclipse\n \t\t// and Pure Java does not know what to do about symbolic links.\n \t}\n+\n+\tpublic void visitGitlink(GitlinkTreeEntry s) throws IOException {\n+\t\t// TODO: handle gitlinks.\n+\t}\n }\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java b/org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java\nnew file mode 100644\nindex 0000000..babbc26\n--- /dev/null\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java\n@@ -0,0 +1,85 @@\n+/*\n+ * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>\n+ * Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org>\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.lib;\n+\n+import java.io.IOException;\n+\n+/**\n+ * A tree entry representing a symbolic link.\n+ *\n+ * Note. Java cannot really handle these as file system objects.\n+ */\n+public class GitlinkTreeEntry extends TreeEntry {\n+\tprivate static final long serialVersionUID = 1L;\n+\n+\t/**\n+\t * Construct a {@link SymlinkTreeEntry} with the specified name and SHA-1 in\n+\t * the specified parent\n+\t *\n+\t * @param parent\n+\t * @param id\n+\t * @param nameUTF8\n+\t */\n+\tpublic GitlinkTreeEntry(final Tree parent, final ObjectId id,\n+\t\t\tfinal byte[] nameUTF8) {\n+\t\tsuper(parent, id, nameUTF8);\n+\t}\n+\n+\tpublic FileMode getMode() {\n+\t\treturn FileMode.GITLINK;\n+\t}\n+\n+\tpublic void accept(final TreeVisitor tv, final int flags)\n+\t\t\tthrows IOException {\n+\t\tif ((MODIFIED_ONLY & flags) == MODIFIED_ONLY && !isModified()) {\n+\t\t\treturn;\n+\t\t}\n+\n+\t\ttv.visitGitlink(this);\n+\t}\n+\n+\t@Override\n+\tpublic String toString() {\n+\t\tfinal StringBuffer r = new StringBuffer();\n+\t\tr.append(ObjectId.toString(getId()));\n+\t\tr.append(\" G \");\n+\t\tr.append(getFullName());\n+\t\treturn r.toString();\n+\t}\n+}\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitor.java b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitor.java\nindex 78a6c22..8293c24 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitor.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitor.java\n@@ -77,4 +77,12 @@\n \t * @throws IOException\n \t */\n \tpublic void visitSymlink(final SymlinkTreeEntry s) throws IOException;\n+\n+\t/**\n+\t * Visit to a gitlink.\n+\t *\n+\t * @param s Gitlink entry\n+\t * @throws IOException\n+\t */\n+\tpublic void visitGitlink(final GitlinkTreeEntry s) throws IOException;\n }\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WriteTree.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WriteTree.java\nindex 9841678..d6725a9 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/WriteTree.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WriteTree.java\n@@ -41,6 +41,7 @@\n import java.io.File;\n import java.io.IOException;\n \n+import org.spearce.jgit.errors.GitlinksNotSupportedException;\n import org.spearce.jgit.errors.SymlinksNotSupportedException;\n \n /**\n@@ -78,4 +79,10 @@ public void endVisitTree(final Tree t) throws IOException {\n \t\tsuper.endVisitTree(t);\n \t\tt.setId(ow.writeTree(t));\n \t}\n+\n+\tpublic void visitGitlink(GitlinkTreeEntry s) throws IOException {\n+\t\tif (s.isModified()) {\n+\t\t\tthrow new GitlinksNotSupportedException(s.getFullName());\n+\t\t}\n+\t}\n }\n-- \n1.6.4.rc3.195.g2b05f\n"},{"id":"120418","messageId":"20090812153210.GF1033@spearce.org","threadId":"20555","inReplyTo":"1250089629-22547-1-git-send-email-fonseca@diku.dk","subject":"Re: [PATCH JGIT 5/5] Treat gitlink tree entries similar to symlink tree entries","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-08-12T15:32:10Z","receivedAt":"2009-08-12T15:32:10Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jonas Fonseca <fonseca@diku.dk> wrote:\n> Adds minimal support for gitlinks, based on the existing code for\n> handling symlinks. The goal is to avoid exceptions when reading trees\n> with gitlinks.\n\nApplied, but who calls GitlinkTreeEntry ?\n \n>  .../jgit/errors/GitlinksNotSupportedException.java |   58 +++++++++++++\n>  .../src/org/spearce/jgit/lib/ForceModified.java    |    4 +\n>  .../src/org/spearce/jgit/lib/GitlinkTreeEntry.java |   85 ++++++++++++++++++++\n>  .../src/org/spearce/jgit/lib/TreeVisitor.java      |    8 ++\n>  .../src/org/spearce/jgit/lib/WriteTree.java        |    7 ++\n>  5 files changed, 162 insertions(+), 0 deletions(-)\n>  create mode 100644 org.spearce.jgit/src/org/spearce/jgit/errors/GitlinksNotSupportedException.java\n>  create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java\n\n-- \nShawn.\n"},{"id":"120425","messageId":"1250098216-7760-1-git-send-email-fonseca@diku.dk","threadId":"20555","inReplyTo":"20090812153210.GF1033@spearce.org","subject":"[PATCH JGIT] Recognize gitlink tree entries when mapping a tree","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2009-08-12T17:30:16Z","receivedAt":"2009-08-12T17:30:16Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Also adds minimal testing of symlink and gitlink tree entries and amends\ngitlink related javadoc.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n\n On Wed, Aug 12, 2009 at 11:32, Shawn O. Pearce<spearce@spearce.org> wrote:\n > Jonas Fonseca <fonseca@diku.dk> wrote:\n >> Adds minimal support for gitlinks, based on the existing code for\n >> handling symlinks. The goal is to avoid exceptions when reading trees\n >> with gitlinks.\n >\n > Applied, but who calls GitlinkTreeEntry ?\n\n True, here is a follow up, which should fix this. With this the Netbeans\n module no longer dumps stack traces when dealing with a repository containing\n submodules.\n\n .../spearce/jgit/test/resources/create-second-pack |   13 ++++++++++++-\n ...ck-cbdeda40019ae0e6e789088ea0f51f164f489d14.idx |  Bin 0 -> 1240 bytes\n ...k-cbdeda40019ae0e6e789088ea0f51f164f489d14.pack |  Bin 0 -> 651 bytes\n .../org/spearce/jgit/test/resources/packed-refs    |    2 ++\n .../org/spearce/jgit/lib/RepositoryTestCase.java   |    1 +\n .../tst/org/spearce/jgit/lib/T0002_Tree.java       |    7 +++++++\n .../org/spearce/jgit/transport/TransportTest.java  |    2 +-\n .../src/org/spearce/jgit/lib/GitlinkTreeEntry.java |    2 +-\n .../src/org/spearce/jgit/lib/Tree.java             |   14 ++++++++------\n .../src/org/spearce/jgit/lib/TreeEntry.java        |    2 +-\n 10 files changed, 33 insertions(+), 10 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-cbdeda40019ae0e6e789088ea0f51f164f489d14.idx\n create mode 100644 org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-cbdeda40019ae0e6e789088ea0f51f164f489d14.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 5501a67..7241fa6 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@@ -148,8 +148,19 @@ mkdir f\n echo \"an F\" >f/f\n git add f/f\n git commit -m \"An F\"\n+\n git repack -d\n-git pack-refs --all\n \n+git checkout -b symlink master\n+ln -s c/c1.txt symlink.txt\n+git add symlink.txt\n+git_commit -m \"A symlink\"\n+\n+git checkout -b gitlink master\n+git submodule add \"$(pwd)/.git\" submodule\n+git_commit -m \"A gitlink\"\n+\n+git repack -d\n+git pack-refs --all\n \n gitk --all master\ndiff --git a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-cbdeda40019ae0e6e789088ea0f51f164f489d14.idx b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-cbdeda40019ae0e6e789088ea0f51f164f489d14.idx\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..a5aed7def26f945bc329429195702b6c5f82444e\nGIT binary patch\nliteral 1240\nzcmexg;-AdGz`z8=LlH0n9X(VqD2$OYGmwuBvjD}hVOF5{D5h^1umQt-L||Q(cO|zM\nzGgKV9bGy*?cK4G#9KK}{MLm<dW_8ajIK!!&vwq6jB^fi7V;(SYoVVZcamrV9CnoMI\nzycM56ZcfsiRrP4XwN}ZzDP8)fYkSy##?)q<mRHtH`Fu9B>yPaEr_Ga#n2)v}U9D~~\nzW#ai1xsB3Wwl8mU{M4|e>CBhT@0-kPc{h9$XyamDB^6LtD7$dd;$mP{Ndso>L%{G~\nz3Zy}KoCheTvs+fx_VNdg(i1Ef@{3<GG~MPrAv_`8pq2B=iun8P36r;N{?oH6s!a+2\nDf+%BI\n\nliteral 0\nHcmV?d00001\n\ndiff --git a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-cbdeda40019ae0e6e789088ea0f51f164f489d14.pack b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-cbdeda40019ae0e6e789088ea0f51f164f489d14.pack\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..24f69429a0fa4f206a7e6481e17fd0e11725c219\nGIT binary patch\nliteral 651\nzcmV;60(AXQK|@Ob00062000J@4S1ZL%UcS<Fc5{|_pBltu;kKaG9Y62pbMBxrdsTc\nzl7h=O-GXn2|L~PvL<i>(2}m589AalN2)2>jzzK3>0|RypS#7k-Qgn;nxs)tqPt0iB\nzFkobaY@p)$#gqomM$u8;>#lqK)Q@vqsX3Z6-Q`R3Hc7+leACuiht+jnUkn(dYMsYY\nz<PWNP{Tj<OE+6#+d)Pm+;RS#hc$~Y#c!yE9q$o92A=xxB$;jN;z|zFhFgeZ4#4t6<\nz&@d^<B*{F{+ycl=GqNy9GO;k4s2k5@XgRUZQq<7WSV7mo+`xc~%Tb}YGB+nPFPjSh\nz!RHoirVMzTGc+(TGci%nOV2FH%}*)KNiAlGDC(KqHLH7O!5L2Fob^-IF3FgwY+?We\nz3W*F{w&g`0-Pr>9+cboaT)U<|v3Fu4L@tRzfaSvVHEO@V83ZgcIk}_DjXhlQGDI$!\nz!Sm>kK!>~rmK|a{#QF0j9`n5@-)RW3IybSnB(+Gdq@skOY2$^Kw3h+#ZE4#pO8jS;\nz6fWm!G&BPnQCyk?aUX-Hk@m(~t1}bbe)deiP!VXPvHSA@0OH(DH@paVoIT1x4uBvG\nzMA5aJg1DESz>^pkh!r(xO<V3SsBt%We+J3ZL32)M+kdvBX)dp;?d@--$(#znN(aJ1\nzr(p0P9AJ-|0&#S5q33|Ef>RU)745iwN`^1L|0gpF<w63kn7IMT$}+U>0)Z=doIA$2\nzka41VwVIIu5GWK^=H_JPW$TqxlrZSByeqlAn4#j(o!f=Bx4WP0;qWa30EL1Q>o|Cv\nlOV&>|)GMhd0RRgq0=2sxB|X#d2zAH=&~J0;0D{{I$P-a{H+%p9\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 a6a14f2..82fb0d7 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@@ -7,8 +7,10 @@ d0114ab8ac326bab30e3a657a0397578c5a1af88 refs/heads/e\n 47d3697c3747e8184e0dc479ccbd01e359023577 refs/heads/f\n 175d5b80bd9768884d8fced02e9bd33488174396 refs/heads/g\n 175d5b80bd9768884d8fced02e9bd33488174396 refs/heads/prefix/a\n+68cb1f232964f3cd698afc1dafe583937203c587 refs/heads/gitlink\n 49322bb17d3acc9146f98c97d078513228bbf3c0 refs/heads/master\n d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864 refs/heads/pa\n+5ce00008cf3fb8f194f52742020bd40d78f3f1b3 refs/heads/symlink\n 6db9c2ebf75590eef973081736730a9ea169a0c4 refs/tags/A\n 17768080a2318cd89bba4c8b87834401e2095703 refs/tags/B\n ^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864\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 6de9afe..b1adde9 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@@ -249,6 +249,7 @@ public void run() {\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-cbdeda40019ae0e6e789088ea0f51f164f489d14\",\n \t\t\t\t\"pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa\",\n \t\t\t\t\"pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12\"\n \t\t};\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0002_Tree.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0002_Tree.java\nindex 97f299c..febcbc6 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0002_Tree.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0002_Tree.java\n@@ -271,4 +271,11 @@ public void test008_SubtreeInternalSorting() throws IOException {\n \t\tassertSame(e4, ents[3]);\n \t\tassertSame(e2, ents[4]);\n \t}\n+\n+\tpublic void test009_SymlinkAndGitlink() throws IOException {\n+\t\tfinal Tree symlinkTree = db.mapTree(\"symlink\");\n+\t\tassertTrue(\"Symlink entry exists\", symlinkTree.existsBlob(\"symlink.txt\"));\n+\t\tfinal Tree gitlinkTree = db.mapTree(\"gitlink\");\n+\t\tassertTrue(\"Gitlink entry exists\", gitlinkTree.existsBlob(\"submodule\"));\n+\t}\n }\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/TransportTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/TransportTest.java\nindex fcf3f5c..c6bd13d 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/TransportTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/TransportTest.java\n@@ -123,7 +123,7 @@ public void testFindRemoteRefUpdatesWildcardNoTracking() throws IOException {\n \t\t\t\t.findRemoteRefUpdatesFor(Collections.nCopies(1, new RefSpec(\n \t\t\t\t\t\t\"+refs/heads/*:refs/heads/test/*\")));\n \n-\t\tassertEquals(10, result.size());\n+\t\tassertEquals(12, result.size());\n \t\tboolean foundA = false;\n \t\tboolean foundB = false;\n \t\tfor (final RemoteRefUpdate rru : result) {\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java b/org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java\nindex db6a8e2..5cabbd6 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/GitlinkTreeEntry.java\n@@ -42,7 +42,7 @@\n import java.io.IOException;\n \n /**\n- * A tree entry representing a symbolic link.\n+ * A tree entry representing a gitlink entry used for submodules.\n  *\n  * Note. Java cannot really handle these as file system objects.\n  */\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java\nindex ff9e666..291fce8 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java\n@@ -428,7 +428,7 @@ private boolean exists(final String s, byte slast) throws IOException {\n \t}\n \n \t/**\n-\t * @param path\n+\t * @param path to the tree.\n \t * @return true if a tree with the specified path can be found under this\n \t *         tree.\n \t * @throws IOException\n@@ -438,9 +438,9 @@ public boolean existsTree(String path) throws IOException {\n \t}\n \n \t/**\n-\t * @param path\n-\t * @return true if a blob or symlink with the specified name can be found\n-\t *         under this tree.\n+\t * @param path of the non-tree entry.\n+\t * @return true if a blob, symlink, or gitlink with the specified name\n+\t *         can be found under this tree.\n \t * @throws IOException\n \t */\n \tpublic boolean existsBlob(String path) throws IOException {\n@@ -576,10 +576,12 @@ else if (c < '0' || c > '7')\n \t\t\t\tent = new FileTreeEntry(this, id, name, false);\n \t\t\telse if (FileMode.EXECUTABLE_FILE.equals(mode))\n \t\t\t\tent = new FileTreeEntry(this, id, name, true);\n-\t\t\telse if (FileMode.TREE.equals(mode)) {\n+\t\t\telse if (FileMode.TREE.equals(mode))\n \t\t\t\tent = new Tree(this, id, name);\n-\t\t\t} else if (FileMode.SYMLINK.equals(mode))\n+\t\t\telse if (FileMode.SYMLINK.equals(mode))\n \t\t\t\tent = new SymlinkTreeEntry(this, id, name);\n+\t\t\telse if (FileMode.GITLINK.equals(mode))\n+\t\t\t\tent = new GitlinkTreeEntry(this, id, name);\n \t\t\telse\n \t\t\t\tthrow new CorruptObjectException(getId(), \"Invalid mode: \"\n \t\t\t\t\t\t+ Integer.toOctalString(mode));\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java\nindex c95863c..4921c7a 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java\n@@ -232,7 +232,7 @@ public int compareTo(final Object o) {\n \t * @return '/' for Tree entries and NUL for non-treeish objects.\n \t */\n \tfinal public static int lastChar(TreeEntry treeEntry) {\n-\t\tif (treeEntry instanceof FileTreeEntry)\n+\t\tif (!(treeEntry instanceof Tree))\n \t\t\treturn '\\0';\n \t\telse\n \t\t\treturn '/';\n-- \n1.6.4.rc3.195.g2b05f\n"}]}