Create a gist now

Instantly share code, notes, and snippets.

JGit checkout of directory
@Test
public void testCheckoutOfDirectoryShouldBeRecursive() throws Exception {
File a = writeTrashFile("dir/a.txt", "A");
File b = writeTrashFile("dir/sub/b.txt", "B");
git.add().addFilepattern("dir").call();
write(a, "modified");
write(b, "modified");
git.checkout().addPath("dir").call();
assertThat(read(a), is("A"));
assertThat(read(b), is("B"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment