List of usage examples for org.eclipse.jgit.lib MutableObjectId name
public final String name()
name.
From source file:com.tasktop.c2c.server.scm.service.GitBrowseUtil.java
License:Open Source License
public static Trees getTrees(Repository r, String revision, String path, boolean history, int recursion) throws IOException, GitAPIException, EntityNotFoundException { if (path.startsWith("/")) { path = path.substring(1);//from w w w .ja v a2 s.c o m } RevObject revId = resolveRevision(r, revision); MutableObjectId revTree = new MutableObjectId(); TreeWalk treeWalk = getTreeOnPath(revTree, r, revId, path); if (treeWalk == null) { throw new EntityNotFoundException("Revision: " + revision + ", path: " + path + " not found."); } Trees trees = new Trees(revTree.name()); Git git = history ? new Git(r) : null; while (treeWalk.next()) { ObjectLoader loader = r.open(treeWalk.getObjectId(0)); Trees.Tree t = new Trees.Tree(treeWalk.getObjectId(0).getName(), // sha treeWalk.getPathString(), // path treeWalk.getNameString(), // name getType(loader.getType()), // type treeWalk.getRawMode(0), // mode loader.getSize() // size ); trees.getTree().add(t); if (recursion == -2 && t.getType() == Item.Type.TREE) { t.setEmpty(getEmptyPath(r, treeWalk.getObjectId(0))); } if (history) { addHistory(git, t, revId, /* path + ( path.length() == 0 ? "" : "/") + */t.getPath()); } } return trees; }