sha_for_branch spec and related fixes