commit | 5188c231043982c83f5bfbb5b0a7a8bde58cfe42 | [log] [tgz] |
---|---|---|
author | David Pursehouse <david.pursehouse@gmail.com> | Fri Jul 28 06:08:33 2017 -0400 |
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | Fri Jul 28 06:08:33 2017 -0400 |
tree | 39ab7e84f40de21504805bf54659b11c86d2b026 | |
parent | 94aebcb94913bd565d39f997609abaa3e247dd11 [diff] | |
parent | da0770fdec64b00be7c4c22d5acebee622bbf5f3 [diff] |
Merge "Fix committing empty commits"
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 37fee40..a0834e7 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
@@ -557,6 +557,11 @@ } catch (EmtpyCommitException e) { // expect this exception } + + // Allow empty commits also when setOnly was set + git.commit().setAuthor("New Author", "newauthor@example.org") + .setMessage("again no change").setOnly("file1") + .setAllowEmpty(true).call(); } }
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java index 274ece6..e29fc05 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
@@ -482,7 +482,7 @@ JGitText.get().entryNotFoundByPath, only.get(i))); // there must be at least one change - if (emptyCommit) + if (emptyCommit && !allowEmpty.booleanValue()) // Would like to throw a EmptyCommitException. But this would break the API // TODO(ch): Change this in the next release throw new JGitInternalException(JGitText.get().emptyCommit);