Browse Source

Add a CommitBuilder method to edit arbitrary DirCacheEntrys

Change-Id: Ic2f5ec28621219a8ff1272674e2bf2c8d36eb107
stable-2.1
Dave Borowitz 13 years ago
parent
commit
9346f1cc94
  1. 8
      org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java

8
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java

@ -793,14 +793,18 @@ public class TestRepository<R extends Repository> {
public CommitBuilder add(String path, final RevBlob id) public CommitBuilder add(String path, final RevBlob id)
throws Exception { throws Exception {
DirCacheEditor e = tree.editor(); return edit(new PathEdit(path) {
e.add(new PathEdit(path) {
@Override @Override
public void apply(DirCacheEntry ent) { public void apply(DirCacheEntry ent) {
ent.setFileMode(FileMode.REGULAR_FILE); ent.setFileMode(FileMode.REGULAR_FILE);
ent.setObjectId(id); ent.setObjectId(id);
} }
}); });
}
public CommitBuilder edit(PathEdit edit) {
DirCacheEditor e = tree.editor();
e.add(edit);
e.finish(); e.finish();
return this; return this;
} }

Loading…
Cancel
Save