summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst-rsrc
diff options
context:
space:
mode:
authorJack Wickham <jwickham@palantir.com>2020-04-17 18:33:39 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2020-05-06 08:50:08 +0200
commitd69c0ef5bdadda57ac457e56f6ca0291131d8d9b (patch)
tree54f738968c0b26cfd55c5088a9f1a2a3b584212f /org.eclipse.jgit.test/tst-rsrc
parent0a2a094feaac41966f3de22748d80d4d29a7ba30 (diff)
downloadjgit-d69c0ef5bdadda57ac457e56f6ca0291131d8d9b.tar.gz
jgit-d69c0ef5bdadda57ac457e56f6ca0291131d8d9b.zip
Create parent directories when renaming a file in ApplyCommand
Before this change, applying a patch will fail if the destination directory doesn't exist; after, the necessary parent directories are created. If renaming the file fails, the directories won't be deleted, so this change isn't atomic. However, ApplyCommand is already not atomic - if one hunk fails to apply, other hunks still get applied - so I don't think that is a blocker. Change-Id: Iea36138b806d4e7012176615bcc673756a82f365 Signed-off-by: Jack Wickham <jwickham@palantir.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst-rsrc')
-rw-r--r--org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks.patch4
-rw-r--r--org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks_PostImage4
-rw-r--r--org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks_PreImage4
3 files changed, 12 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks.patch b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks.patch
new file mode 100644
index 0000000000..db543abf5d
--- /dev/null
+++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks.patch
@@ -0,0 +1,4 @@
+diff --git a/RenameNoHunks b/nested/subdir/Renamed
+similarity index 100%
+rename from RenameNoHunks
+rename to nested/subdir/Renamed
diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks_PostImage b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks_PostImage
new file mode 100644
index 0000000000..84275f9939
--- /dev/null
+++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks_PostImage
@@ -0,0 +1,4 @@
+line1
+line2
+line3
+line4
diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks_PreImage b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks_PreImage
new file mode 100644
index 0000000000..84275f9939
--- /dev/null
+++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/RenameNoHunks_PreImage
@@ -0,0 +1,4 @@
+line1
+line2
+line3
+line4