@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); }
private RevCommit squashIntoPrevious(boolean sequenceContainsSquash, RebaseTodoLine nextStep) throws IOException, GitAPIException { RevCommit retNewHead; String commitMessage = rebaseState .readFile(MESSAGE_SQUASH); try (Git git = new Git(repo)) { if (nextStep == null || ((nextStep.getAction() != Action.FIXUP) && (nextStep.getAction() != Action.SQUASH))) { // this is the last step in this sequence if (sequenceContainsSquash) { commitMessage = interactiveHandler .modifyCommitMessage(commitMessage); } retNewHead = git.commit() .setMessage(stripCommentLines(commitMessage)) .setAmend(true).setNoVerify(true).call(); rebaseState.getFile(MESSAGE_SQUASH).delete(); rebaseState.getFile(MESSAGE_FIXUP).delete(); } else { // Next step is either Squash or Fixup retNewHead = git.commit().setMessage(commitMessage) .setAmend(true).setNoVerify(true).call(); } } return retNewHead; }
.modifyCommitMessage(oldMessage); try (Git git = new Git(repo)) { newHead = git.commit().setMessage(newMessage).setAmend(true) .setNoVerify(true).call();
.setAmend(isAmend).setMessage(msg); if (authorName != null && authorEmail != null) { cc.setAuthor(authorName, authorEmail);
.setAmend(isAmend).setMessage(msg); if (authorName != null && authorEmail != null) { cc.setAuthor(authorName, authorEmail);
private RevCommit squashIntoPrevious(boolean sequenceContainsSquash, RebaseTodoLine nextStep) throws IOException, GitAPIException { RevCommit retNewHead; String commitMessage = rebaseState .readFile(MESSAGE_SQUASH); try (Git git = new Git(repo)) { if (nextStep == null || ((nextStep.getAction() != Action.FIXUP) && (nextStep.getAction() != Action.SQUASH))) { // this is the last step in this sequence if (sequenceContainsSquash) { commitMessage = interactiveHandler .modifyCommitMessage(commitMessage); } retNewHead = git.commit() .setMessage(stripCommentLines(commitMessage)) .setAmend(true).setNoVerify(true).call(); rebaseState.getFile(MESSAGE_SQUASH).delete(); rebaseState.getFile(MESSAGE_FIXUP).delete(); } else { // Next step is either Squash or Fixup retNewHead = git.commit().setMessage(commitMessage) .setAmend(true).setNoVerify(true).call(); } } return retNewHead; }
private RevCommit squashIntoPrevious(boolean sequenceContainsSquash, RebaseTodoLine nextStep) throws IOException, GitAPIException { RevCommit retNewHead; String commitMessage = rebaseState .readFile(MESSAGE_SQUASH); try (Git git = new Git(repo)) { if (nextStep == null || ((nextStep.getAction() != Action.FIXUP) && (nextStep.getAction() != Action.SQUASH))) { // this is the last step in this sequence if (sequenceContainsSquash) { commitMessage = interactiveHandler .modifyCommitMessage(commitMessage); } retNewHead = git.commit() .setMessage(stripCommentLines(commitMessage)) .setAmend(true).setNoVerify(true).call(); rebaseState.getFile(MESSAGE_SQUASH).delete(); rebaseState.getFile(MESSAGE_FIXUP).delete(); } else { // Next step is either Squash or Fixup retNewHead = git.commit().setMessage(commitMessage) .setAmend(true).setNoVerify(true).call(); } } return retNewHead; }
.setAmend(amend) .call(); gitPatchRepository.push(git);
.setAmend(amend) .call(); gitPatchRepository.push(git);
for (String p : paths) commitCmd.setOnly(p); commitCmd.setAmend(amend); commitCmd.setAll(all); Ref head = db.getRef(Constants.HEAD);
@Override public void flush(boolean success) { if (success) { try (Git git = gitRepository.getGit()) { Status status = git.status().call(); if (!status.isClean()) { String message = git.getRepository().parseCommit(git.getRepository().resolve(HEAD)).getFullMessage(); if(! status.getUntracked().isEmpty() || ! status.getUntrackedFolders().isEmpty()) { AddCommand addCommand = git.add(); for(String untracked : status.getUntrackedFolders()) { addCommand = addCommand.addFilepattern(untracked); } for(String untracked : status.getUntracked()) { addCommand = addCommand.addFilepattern(untracked); } addCommand.call(); } git.commit().setMessage(message).setAmend(true).setAll(true).setNoVerify(true).call(); } } catch (RevisionSyntaxException | IOException | GitAPIException ex) { throw new RuntimeException(ex); } } }
@Override public void flush(boolean success) { if (success) { try (Git git = gitRepository.getGit()) { Status status = git.status().call(); if (!status.isClean()) { String message = git.getRepository().parseCommit(git.getRepository().resolve(HEAD)).getFullMessage(); if(! status.getUntracked().isEmpty() || ! status.getUntrackedFolders().isEmpty()) { AddCommand addCommand = git.add(); for(String untracked : status.getUntrackedFolders()) { addCommand = addCommand.addFilepattern(untracked); } for(String untracked : status.getUntracked()) { addCommand = addCommand.addFilepattern(untracked); } addCommand.call(); } git.commit().setMessage(message).setAmend(true).setAll(true).setNoVerify(true).call(); } } catch (RevisionSyntaxException | IOException | GitAPIException ex) { throw new RuntimeException(ex); } } }
.modifyCommitMessage(oldMessage); newHead = new Git(repo).commit().setMessage(newMessage) .setAmend(true).setNoVerify(true).call(); return null; case EDIT:
.modifyCommitMessage(oldMessage); try (Git git = new Git(repo)) { newHead = git.commit().setMessage(newMessage).setAmend(true) .setNoVerify(true).call();