async def test_compare_to_invalid_ref(self, mock_run_git, mock_status, mock_find_repos, tool):
        """Test comparing to an invalid git ref"""
        mock_find_repos.return_value = ["/test/repo"]
        mock_status.return_value = {"branch": "main"}

        # Mock git commands - ref validation fails
        mock_run_git.side_effect = [
            (False, "fatal: not a valid ref"),  # rev-parse fails
        ]

        request = PrecommitRequest(path="/absolute/repo/path", compare_to="invalid-branch")
        result = await tool.prepare_prompt(request)

        # When all repos have errors and no changes, we get this message
        assert "No pending changes found in any of the git repositories." in result
Test comparing to an invalid git ref
tests/test_precommit.py