@Signature public Memory commit(String message, ArrayMemory settings) throws GitAPIException { CommitCommand commit = getWrappedObject().commit(); commit.setMessage(message); if (settings != null && settings.isNotNull()) { commit.setAll(settings.valueOfIndex("all").toBoolean()); commit.setAllowEmpty(settings.valueOfIndex("allowEmpty").toBoolean()); commit.setAmend(settings.valueOfIndex("amend").toBoolean()); commit.setInsertChangeId(settings.valueOfIndex("insertChangeId").toBoolean()); commit.setNoVerify(settings.valueOfIndex("noVerify").toBoolean()); Memory author = settings.valueOfIndex("author"); if (author.isArray()) { commit.setAuthor(author.valueOfIndex("name").toString(), author.valueOfIndex("email").toString()); } Memory committer = settings.valueOfIndex("committer"); if (committer.isArray()) { commit.setCommitter(committer.valueOfIndex("name").toString(), committer.valueOfIndex("email").toString()); } if (settings.containsKey("only")) { commit.setOnly(settings.valueOfIndex("only").toString()); } if (settings.containsKey("reflogComment")) { commit.setReflogComment(settings.valueOfIndex("reflogComment").toString()); } } RevCommit call = commit.call(); return GitUtils.valueOf(call); }
git.commit().setAllowEmpty(allowEmpty).setCommitter(username, email).setMessage(commitMessage).call(); } else { git.commit().setAllowEmpty(allowEmpty).setMessage(commitMessage).call();
git.commit().setAllowEmpty(allowEmpty).setAll(true).setCommitter(username, email).setMessage(commitMessage).call(); } else { git.commit().setAllowEmpty(allowEmpty).setAll(true).setMessage(commitMessage).call();
/** * Performs a commit * @param project - a Git project * @param message - commit message */ CommitResult commit(File project, String message) { try (Git git = this.gitFactory.open(file(project))) { git.add().addFilepattern(".").call(); git.commit().setAllowEmpty(false).setMessage(message).call(); log.info("Commited successfully with message [" + message + "]"); return CommitResult.SUCCESSFUL; } catch (EmptyCommitException e) { log.info("There were no changes detected. Will not commit an empty commit"); return CommitResult.EMPTY; } catch (Exception e) { throw new IllegalStateException(e); } }
@Override public void commitAll(final String message) throws RepositoryException { checkReadyForCommit(); performOperation(getGit().commit() .setMessage(message) .setAllowEmpty(false) .setAll(true)); }