public
Created

JGit checkout of directory

  • Download Gist
jgit-checkout-dir.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13
@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"));
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.