aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/api
diff options
context:
space:
mode:
authorNadav Cohen <nadavcoh@gmail.com>2016-05-01 19:06:39 -0700
committerNadav Cohen <nadavcoh@gmail.com>2016-05-17 00:08:01 -0700
commite81592e07692284aab607e959096030027067695 (patch)
tree5e4e1dbc115f592b2acc6790edcd9c3b638d09a3 /org.eclipse.jgit.test/tst/org/eclipse/jgit/api
parent00db4ab06ea5411732ca77cebc823d90cc59e372 (diff)
downloadjgit-e81592e07692284aab607e959096030027067695.tar.gz
jgit-e81592e07692284aab607e959096030027067695.zip
Allow setting FileMode to executable when applying patches in ApplyCommand
git-apply allows modifying file modes in patched files using either "new mode" or "new file mode" headers. This patch adds support for setting files as executables and vice-versa. Change-Id: I24848966b46f686f540a8efa8150b42e0d9c3ad1 Signed-off-by: Nadav Cohen <nadavcoh@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java
index f2b5b3ba95..172807c43d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java
@@ -44,6 +44,7 @@ package org.eclipse.jgit.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.ByteArrayOutputStream;
@@ -157,6 +158,33 @@ public class ApplyCommandTest extends RepositoryTestCase {
}
@Test
+ public void testAddM1() throws Exception {
+ ApplyResult result = init("M1", false, true);
+ assertEquals(1, result.getUpdatedFiles().size());
+ assertTrue(result.getUpdatedFiles().get(0).canExecute());
+ checkFile(new File(db.getWorkTree(), "M1"),
+ b.getString(0, b.size(), false));
+ }
+
+ @Test
+ public void testModifyM2() throws Exception {
+ ApplyResult result = init("M2", true, true);
+ assertEquals(1, result.getUpdatedFiles().size());
+ assertTrue(result.getUpdatedFiles().get(0).canExecute());
+ checkFile(new File(db.getWorkTree(), "M2"),
+ b.getString(0, b.size(), false));
+ }
+
+ @Test
+ public void testModifyM3() throws Exception {
+ ApplyResult result = init("M3", true, true);
+ assertEquals(1, result.getUpdatedFiles().size());
+ assertFalse(result.getUpdatedFiles().get(0).canExecute());
+ checkFile(new File(db.getWorkTree(), "M3"),
+ b.getString(0, b.size(), false));
+ }
+
+ @Test
public void testModifyX() throws Exception {
ApplyResult result = init("X");
assertEquals(1, result.getUpdatedFiles().size());