Sort the branch list used to rebuild the last revision if there's no other candidate rev to build. It ensures a deterministic value for GIT_BRANCH and allows a git-flow style workflow with fast-forward merges between branches