From 9346f1cc942cf320130cb303f4299a027d8d306a Mon Sep 17 00:00:00 2001 From: Dave Borowitz Date: Fri, 15 Jun 2012 11:05:12 -0700 Subject: [PATCH] Add a CommitBuilder method to edit arbitrary DirCacheEntrys Change-Id: Ic2f5ec28621219a8ff1272674e2bf2c8d36eb107 --- .../src/org/eclipse/jgit/junit/TestRepository.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index 1afc6d808..b36b5c761 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -793,14 +793,18 @@ public class TestRepository { public CommitBuilder add(String path, final RevBlob id) throws Exception { - DirCacheEditor e = tree.editor(); - e.add(new PathEdit(path) { + return edit(new PathEdit(path) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); ent.setObjectId(id); } }); + } + + public CommitBuilder edit(PathEdit edit) { + DirCacheEditor e = tree.editor(); + e.add(edit); e.finish(); return this; }