summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2015-05-18 12:48:08 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2015-06-01 10:42:21 +0200
commit6d09c486ed833484d9413e3c8f955d2afe27d397 (patch)
tree76d2b55b14655560c41da9e17d0e1fd22345065b /org.eclipse.jgit.test/tst
parentb10259f44b1ad3eaedc78860d16c40c2c536b2cc (diff)
downloadjgit-6d09c486ed833484d9413e3c8f955d2afe27d397.tar.gz
jgit-6d09c486ed833484d9413e3c8f955d2afe27d397.zip
Fix CommitCommand.setOnly()
When CommitCommand.setOnly(path) is used a temporary index has to be created containing only modifications for the specified pathes. The process to fill this temporary index was broken because filling the index was stopped when we reached the first untracked file. Instead the process to fill the temporary index should continue until we processed all pathes. Bug: 451465 Change-Id: I22af50d70bd3b81e7c056358724956122b0d158d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
index 54fbc6671a..060a5b65c6 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
@@ -514,6 +514,17 @@ public class CommitCommandTest extends RepositoryTestCase {
}
}
+ @Test
+ public void commitOnlyShouldHandleIgnored() throws Exception {
+ try (Git git = new Git(db)) {
+ writeTrashFile("subdir/foo", "Hello World");
+ writeTrashFile("subdir/bar", "Hello World");
+ writeTrashFile(".gitignore", "bar");
+ git.add().addFilepattern("subdir").call();
+ git.commit().setOnly("subdir").setMessage("first commit").call();
+ }
+ }
+
private static void addUnmergedEntry(String file, DirCacheBuilder builder) {
DirCacheEntry stage1 = new DirCacheEntry(file, DirCacheEntry.STAGE_1);
DirCacheEntry stage2 = new DirCacheEntry(file, DirCacheEntry.STAGE_2);