| | |
| | | clone.call();
|
| | | cloned = true;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | // swallow the exception which we expect
|
| | | }
|
| | |
|
| | | // restore anonymous repository access
|
| | |
| | | public void testAnonymousCommit() throws Exception {
|
| | | Git git = Git.open(folder);
|
| | | File file = new File(folder, "TODO");
|
| | | OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(file, true));
|
| | | BufferedWriter w = new BufferedWriter(os);
|
| | | w.write("// " + new Date().toString() + "\n");
|
| | | w.close();
|
| | | git.add().addFilepattern(file.getName()).call();
|
| | | git.commit().setMessage("test commit").call();
|
| | | for (int i = 0; i < 3; i++) {
|
| | | OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(file, true));
|
| | | BufferedWriter w = new BufferedWriter(os);
|
| | | w.write("// " + new Date().toString() + "\n");
|
| | | w.close();
|
| | | git.add().addFilepattern(file.getName()).call();
|
| | | git.commit().setMessage("test commit #" + (i + 1)).call();
|
| | | }
|
| | | git.push().setPushAll().call();
|
| | | git.getRepository().close();
|
| | | }
|