aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2012-01-07 14:00:14 +0100
committerRobin Rosenberg <robin.rosenberg@dewire.com>2012-01-13 11:24:31 +0100
commitd5c890e0fdbfdd5d532121a2eb812ee2143c8ab5 (patch)
treed56c15ab41ef216fb22e5f00984dcd5373690e4a /org.eclipse.jgit.test/tst/org
parent6a582970bfa1120dfe99e7568ea2d471dfc59387 (diff)
downloadjgit-d5c890e0fdbfdd5d532121a2eb812ee2143c8ab5.tar.gz
jgit-d5c890e0fdbfdd5d532121a2eb812ee2143c8ab5.zip
Cannot commit -o file with only file permission change
Bug 345076 Change-Id: Ie64039793ab6ba4748731320399f03301b6282ec Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java
index aac1dc1496..e6b6a096fa 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java
@@ -67,6 +67,7 @@ import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.storage.file.ReflogReader;
import org.eclipse.jgit.treewalk.TreeWalk;
+import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.RawParseUtils;
import org.junit.Test;
@@ -267,6 +268,36 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
}
@Test
+ public void testModeChange() throws IOException, NoFilepatternException,
+ NoHeadException, NoMessageException, ConcurrentRefUpdateException,
+ JGitInternalException, WrongRepositoryStateException {
+ Git git = new Git(db);
+
+ // create file
+ File file = new File(db.getWorkTree(), "a.txt");
+ FileUtils.createNewFile(file);
+ PrintWriter writer = new PrintWriter(file);
+ writer.print("content1");
+ writer.close();
+
+ // First commit - a.txt file
+ git.add().addFilepattern("a.txt").call();
+ git.commit().setMessage("commit1").setCommitter(committer).call();
+
+ // pure mode change should be committable
+ FS fs = db.getFS();
+ fs.setExecute(file, true);
+ git.add().addFilepattern("a.txt").call();
+ git.commit().setMessage("mode change").setCommitter(committer).call();
+
+ // pure mode change should be committable with -o option
+ fs.setExecute(file, false);
+ git.add().addFilepattern("a.txt").call();
+ git.commit().setMessage("mode change").setCommitter(committer)
+ .setOnly("a.txt").call();
+ }
+
+ @Test
public void testCommitRange() throws NoHeadException, NoMessageException,
UnmergedPathException, ConcurrentRefUpdateException,
JGitInternalException, WrongRepositoryStateException,