use of git4idea.commands.GitSimpleHandler in project intellij-community by JetBrains.
the class GitCheckinEnvironment method commit.
private void commit(@NotNull Project project, @NotNull VirtualFile root, @NotNull Collection<FilePath> files, @NotNull File message) throws VcsException {
boolean amend = myNextCommitAmend;
for (List<String> paths : VcsFileUtil.chunkPaths(root, files)) {
GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.COMMIT);
handler.setStdoutSuppressed(false);
if (myNextCommitSignOff) {
handler.addParameters("--signoff");
}
if (amend) {
handler.addParameters("--amend");
} else {
amend = true;
}
handler.addParameters("--only", "-F", message.getAbsolutePath());
if (myNextCommitAuthor != null) {
handler.addParameters("--author=" + myNextCommitAuthor);
}
if (myNextCommitAuthorDate != null) {
handler.addParameters("--date", COMMIT_DATE_FORMAT.format(myNextCommitAuthorDate));
}
handler.endOptions();
handler.addParameters(paths);
handler.run();
}
if (!project.isDisposed()) {
GitRepositoryManager manager = getRepositoryManager(project);
manager.updateRepository(root);
}
}
use of git4idea.commands.GitSimpleHandler in project intellij-community by JetBrains.
the class GitCheckinEnvironment method commitWithoutPaths.
private void commitWithoutPaths(@NotNull Project project, @NotNull VirtualFile root, @NotNull File messageFile, @Nullable String author) throws VcsException {
GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.COMMIT);
handler.setStdoutSuppressed(false);
handler.addParameters("-F", messageFile.getAbsolutePath());
if (author != null) {
handler.addParameters("--author=" + author);
}
if (myNextCommitSignOff) {
handler.addParameters("--signoff");
}
handler.endOptions();
handler.run();
}
use of git4idea.commands.GitSimpleHandler in project intellij-community by JetBrains.
the class GitConfigUtil method getAllValues.
/**
* Get configuration values for the repository. Note that the method executes a git command.
*
* @param project the context project
* @param root the git root
* @param key the keys to be queried
* @return list of pairs ({@link Pair#first} is the key, {@link Pair#second} is the value)
* @throws VcsException an exception
*/
public static List<Couple<String>> getAllValues(Project project, VirtualFile root, @NonNls String key) throws VcsException {
List<Couple<String>> result = new ArrayList<>();
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.CONFIG);
h.setSilent(true);
h.addParameters("--null", "--get-all", key);
String output = h.run();
int start = 0;
int pos;
while ((pos = output.indexOf('