Example usage for org.eclipse.jgit.api NameRevCommand add

List of usage examples for org.eclipse.jgit.api NameRevCommand add

Introduction

In this page you can find the example usage for org.eclipse.jgit.api NameRevCommand add.

Prototype

public NameRevCommand add(Iterable<ObjectId> ids) throws MissingObjectException, JGitInternalException 

Source Link

Document

Add multiple objects to search for.

Usage

From source file:com.google.gitiles.DescribeServlet.java

License:Open Source License

private NameRevCommand nameRevCommand(ObjectId id, HttpServletRequest req, HttpServletResponse res)
        throws IOException {
    Repository repo = ServletUtils.getRepository(req);
    GitilesView view = ViewFilter.getView(req);
    NameRevCommand cmd = new Git(repo).nameRev();
    boolean all = getBooleanParam(view, ALL_PARAM);
    boolean tags = getBooleanParam(view, TAGS_PARAM);
    if (all && tags) {
        renderTextError(req, res, SC_BAD_REQUEST, "Cannot specify both \"all\" and \"tags\"");
        return null;
    }/* ww  w.  j a  v a2s .  c o  m*/
    if (all) {
        cmd.addPrefix(Constants.R_REFS);
    } else if (tags) {
        cmd.addPrefix(Constants.R_TAGS);
    } else {
        cmd.addAnnotatedTags();
    }
    cmd.add(id);
    return cmd;
}