Fixing Repo.state to return last_build_state reference.

Also added a line to test state against last_build_state so coverage may be improved.