@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); }
.setAll(true) .setMessage("Commit changes to all files") .call();
.setAll(true) .setMessage("Commit changes to all files") .call();
@Override public void commitAll(final String message) throws RepositoryException { checkReadyForCommit(); performOperation(getGit().commit() .setMessage(message) .setAllowEmpty(false) .setAll(true)); }
@Override public void commitAll(final Git repo, String message) throws GitAPIException { repo.commit().setMessage(message).setAll(true).call(); }
/** * Commit. * * @param message the message * @return the rev commit * @throws GitAPIException the exception */ public RevCommit commit(final String message) throws GitAPIException { if (!isUndefined()) { return git.commit().setAll(true).setMessage(message).call(); } return null; }
/** * Commits all working changes to the repository with the passed commit message. * * @param user - CasUserProfile of the logged in user. * @param msg - Commit message. * @return - RevCommit of the new commit. * @throws GitAPIException - failed. */ public RevCommit commit(final CasUserProfile user, final String msg) throws GitAPIException { return git.commit() .setAll(true) .setCommitter(getCommitterId(user)) .setMessage(msg) .call(); }
protected CommitInfo doCreateDirectory(Git git, File rootDir, String branch, String path, PersonIdent personIdent, String commitMessage) throws Exception { File file = getFile(rootDir, path); if (file.exists()) { return null; } file.mkdirs(); String filePattern = getFilePattern(path); AddCommand add = git.add().addFilepattern(filePattern).addFilepattern("."); add.call(); CommitCommand commit = git.commit().setAll(true).setAuthor(personIdent).setMessage(commitMessage); RevCommit revCommit = commitThenPush(git, branch, commit); return createCommitInfo(revCommit); }
protected void gitCommit(String msg) { try (Git git = repository.getGit()) { if(!git.status().call().isClean()) { git.commit().setMessage(msg).setAll(true).setNoVerify(true).call(); } } catch (GitAPIException e) { MGMT_OP_LOGGER.failedToStoreConfiguration(e, file.getName()); } }
protected CommitInfo doCreateDirectory(Git git, String path) throws Exception { File file = getRelativeFile(path); if (file.exists()) { return null; } file.mkdirs(); String filePattern = getFilePattern(path); AddCommand add = git.add().addFilepattern(filePattern).addFilepattern("."); add.call(); CommitCommand commit = git.commit().setAll(true).setAuthor(personIdent).setMessage(message); RevCommit revCommit = commitThenPush(git, commit); return createCommitInfo(revCommit); }
protected CommitInfo doWrite(Git git, File rootDir, String branch, String path, byte[] contents, PersonIdent personIdent, String commitMessage) throws Exception { File file = getFile(rootDir, path); file.getParentFile().mkdirs(); IOHelper.write(file, contents); String filePattern = getFilePattern(path); AddCommand add = git.add().addFilepattern(filePattern).addFilepattern("."); add.call(); CommitCommand commit = git.commit().setAll(true).setAuthor(personIdent).setMessage(commitMessage); RevCommit revCommit = commitThenPush(git, branch, commit); return createCommitInfo(revCommit); }
protected void gitCommit(String msg) { try (Git git = repository.getGit()) { if(!git.status().call().isClean()) { git.commit().setMessage(msg).setAll(true).setNoVerify(true).call(); } } catch (GitAPIException e) { MGMT_OP_LOGGER.failedToStoreConfiguration(e, file.getName()); } }
protected CommitInfo doWrite(Git git, String path, byte[] contents, PersonIdent personIdent, String commitMessage) throws Exception { File file = getRelativeFile(path); file.getParentFile().mkdirs(); Files.writeToFile(file, contents); String filePattern = getFilePattern(path); AddCommand add = git.add().addFilepattern(filePattern).addFilepattern("."); add.call(); CommitCommand commit = git.commit().setAll(true).setAuthor(personIdent).setMessage(commitMessage); RevCommit revCommit = commitThenPush(git, commit); return createCommitInfo(revCommit); }
protected RevCommit doRemove(Git git, File rootDir, String branch, String path, String commitMessage, PersonIdent personIdent) throws Exception { File file = getFile(rootDir, path); if (file.exists()) { Files.recursiveDelete(file); String filePattern = getFilePattern(path); git.rm().addFilepattern(filePattern).call(); CommitCommand commit = git.commit().setAll(true).setAuthor(personIdent).setMessage(commitMessage); return commitThenPush(git, branch, commit); } else { return null; } }
protected CommitInfo doRemove(Git git, String path) throws Exception { File file = getRelativeFile(path); if (file.exists()) { Files.recursiveDelete(file); String filePattern = getFilePattern(path); git.rm().addFilepattern(filePattern).call(); CommitCommand commit = git.commit().setAll(true).setAuthor(personIdent).setMessage(message); return createCommitInfo(commitThenPush(git, commit)); } else { return null; } }
/** * Commit all changes if there are uncommitted changes. * * @param msg the commit message. * @throws GitAPIException */ public void commit(String msg) throws GitAPIException { try (Git git = getGit()) { Status status = git.status().call(); if (!status.isClean()) { git.commit().setMessage(msg).setAll(true).setNoVerify(true).call(); } } } }
/** * Commit all changes if there are uncommitted changes. * * @param msg the commit message. * @throws GitAPIException */ public void commit(String msg) throws GitAPIException { try (Git git = getGit()) { Status status = git.status().call(); if (!status.isClean()) { git.commit().setMessage(msg).setAll(true).setNoVerify(true).call(); } } } }
public void addAndCommit(String message, GitUser user) { try { git.add().addFilepattern(".").call(); git.commit().setMessage(message).setAuthor(user.getName(), user.getEmail()).setCommitter(user.getName(), user.getEmail()).setAll(true).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }