diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-08-24 17:52:26 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-08-25 17:07:13 -0700 |
commit | dbd2d7c83bc8a3a72a9ce6c4d8d0ae575e381588 (patch) | |
tree | 5f66cb249c31f41ea6fe48ca620b0e8c6860d642 /org.eclipse.jgit.test | |
parent | 8da17c50469f0864e710faf9d068ce2abe1f92fc (diff) | |
download | jgit-dbd2d7c83bc8a3a72a9ce6c4d8d0ae575e381588.tar.gz jgit-dbd2d7c83bc8a3a72a9ce6c4d8d0ae575e381588.zip |
Support parsing commit:path style blob references
We can now resolve expressions that reference a path within a
commit, designating a specific revision of a specific tree or
file in the project.
Change-Id: Ie6a8be629d264d72209db894bd680c5900035cc0
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java | 21 |
1 files changed, 21 insertions, 0 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 4ca9ba0208..0aa8db474f 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 @@ -160,4 +160,25 @@ public class RepositoryResolveTest extends SampleDataRepositoryTestCase { assertEquals(db.resolve("b^1"), db.resolve("B-6-g7f82283^1")); assertEquals(db.resolve("b~2"), db.resolve("B-6-g7f82283~2")); } + + public void testParseLookupPath() throws IOException { + ObjectId b2_txt = id("10da5895682013006950e7da534b705252b03be6"); + ObjectId b3_b2_txt = id("e6bfff5c1d0f0ecd501552b43a1e13d8008abc31"); + ObjectId b_root = id("acd0220f06f7e4db50ea5ba242f0dfed297b27af"); + ObjectId master_txt = id("82b1d08466e9505f8666b778744f9a3471a70c81"); + + assertEquals(b2_txt, db.resolve("b:b/b2.txt")); + assertEquals(b_root, db.resolve("b:")); + assertEquals(master_txt, db.resolve(":master.txt")); + assertEquals(b3_b2_txt, db.resolve("b~3:b/b2.txt")); + + assertNull("no FOO", db.resolve("b:FOO")); + assertNull("no b/FOO", db.resolve("b:b/FOO")); + assertNull("no b/FOO", db.resolve(":b/FOO")); + assertNull("no not-a-branch:", db.resolve("not-a-branch:")); + } + + private static ObjectId id(String name) { + return ObjectId.fromString(name); + } } |