return r;
}
public static void doCheckout(Repository repo, Ref branch, OutputLogger logger) throws IOException {
final GitIndex index = new GitIndex(repo);
final Commit mapCommit = repo.mapCommit(branch.getObjectId());
final Tree tree = mapCommit.getTree();
final RefUpdate u;
final WorkDirCheckout co;
u = repo.updateRef(Constants.HEAD);
u.setNewObjectId(mapCommit.getCommitId());
u.forceUpdate();
// checking out files
co = new WorkDirCheckout(repo, repo.getWorkDir(), index, tree);
co.checkout();
// writing index
index.write();
}