summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit
diff options
context:
space:
mode:
authorJevgeni Zelenkov <jevgeni.zelenkov@gmail.com>2012-08-06 08:59:28 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2012-08-06 08:59:28 +0200
commit803debd7be76a2f18624254409228433c9c329f2 (patch)
treed44f7c61e69fd73d7301c6c56cd751d448b6bfb8 /org.eclipse.jgit.junit
parentd08b35532a2403b0f1b2dbb68436cfa68d2b924a (diff)
downloadjgit-803debd7be76a2f18624254409228433c9c329f2.tar.gz
jgit-803debd7be76a2f18624254409228433c9c329f2.zip
Ensure a directory exists before trying to create/merge a file into it.
Since git doesn't keep track of empty directories, they should be created first. Test case included demonstrates that using StashApplyCommand(). Bugfix is applied to the DirCacheCheckout class, because StashApplyCommand() uses it internally to apply a stash. Change-Id: Iac259229ef919f9e92e7e51a671d877172bb88a8 Signed-off-by: Jevgeni Zelenkov <jevgeni.zelenkov@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.junit')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
index d3da09ffbd..b3376a54be 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
@@ -141,6 +141,14 @@ public abstract class JGitTestUtil {
return path;
}
+ public static File writeTrashFile(final FileRepository db,
+ final String subdir,
+ final String name, final String data) throws IOException {
+ File path = new File(db.getWorkTree() + "/" + subdir, name);
+ write(path, data);
+ return path;
+ }
+
/**
* Write a string as a UTF-8 file.
*