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>
This commit is contained in:
Robin Rosenberg 2012-01-15 23:51:43 +01:00
parent e875c905d3
commit 03b5416a35
2 changed files with 5 additions and 1 deletions

View File

@ -218,6 +218,10 @@ public void testParseLookupPath() throws IOException {
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"));

View File

@ -560,7 +560,7 @@ private ObjectId resolve(final RevWalk rw, final String revstr) throws IOExcepti
tree = rw.parseTree(ref);
}
if (i == rev.length - i)
if (i == rev.length - 1)
return tree.copy();
TreeWalk tw = TreeWalk.forPath(rw.getObjectReader(),