Browse Source

Fix resolution of tree when path is empty

Revision strings that end with a ':' with no trailing path
should return the tree associated with the current ref parsed

Bug: 368370
Change-Id: I7c7617a77bd418bad4e570be2d1e9002ad280762
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
stable-1.3
Robin Rosenberg 13 years ago
parent
commit
03b5416a35
  1. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java

@ -218,6 +218,10 @@ public class RepositoryResolveTest extends SampleDataRepositoryTestCase {
assertEquals(b2_txt, db.resolve("b:b/b2.txt"));
assertEquals(b_root, db.resolve("b:"));
assertEquals(id("6020a3b8d5d636e549ccbd0c53e2764684bb3125"),
db.resolve("master:"));
assertEquals(id("10da5895682013006950e7da534b705252b03be6"),
db.resolve("master:b/b2.txt"));
assertEquals(master_txt, db.resolve(":master.txt"));
assertEquals(b3_b2_txt, db.resolve("b~3:b/b2.txt"));

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

@ -560,7 +560,7 @@ public abstract class Repository {
tree = rw.parseTree(ref);
}
if (i == rev.length - i)
if (i == rev.length - 1)
return tree.copy();
TreeWalk tw = TreeWalk.forPath(rw.getObjectReader(),

Loading…
Cancel
Save