add enum of tree states (with index)
factor out goto(repo)