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

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

Introduction

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

Prototype

@Override
public Map<ObjectId, String> call() throws GitAPIException 

Source Link

Usage

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

License:Open Source License

private String describe(Repository repo, GitilesView view, HttpServletRequest req, HttpServletResponse res)
        throws IOException {
    if (!getBooleanParam(view, CONTAINS_PARAM)) {
        res.setStatus(SC_BAD_REQUEST);//from w  ww .  ja  v  a  2 s.co  m
        return null;
    }
    ObjectId id = resolve(repo, view, req, res);
    if (id == null) {
        return null;
    }
    NameRevCommand cmd = nameRevCommand(id, req, res);
    if (cmd == null) {
        return null;
    }
    String name;
    try {
        name = cmd.call().get(id);
    } catch (GitAPIException e) {
        throw new IOException(e);
    }
    if (name == null) {
        res.setStatus(SC_NOT_FOUND);
        return null;
    }
    return name;
}