コード例 #1
0
 private RevCommit writeCommit(String body, PersonIdent author) throws Exception {
   try (ObjectInserter ins = testRepo.getRepository().newObjectInserter()) {
     CommitBuilder cb = new CommitBuilder();
     cb.setAuthor(author);
     cb.setCommitter(new PersonIdent(serverIdent, author.getWhen()));
     cb.setTreeId(testRepo.tree());
     cb.setMessage(body);
     ObjectId id = ins.insert(cb);
     ins.flush();
     RevCommit commit = walk.parseCommit(id);
     walk.parseBody(commit);
     return commit;
   }
 }
コード例 #2
0
 @After
 public void tearDownTestRepo() throws Exception {
   walk.close();
 }