# Buggy code
async def _get_file_update_statuses(
    self, old_rev: str, new_rev: Optional[str] = None
) -> Dict[str, str]:
    """
    Gets the file update status letters for each changed file between the two revisions.

    Parameters
    ----------
    old_rev : `str`
        Pre-update revision
    new_rev : `str`, optional
        Post-update revision, defaults to repo's branch if not given

    Returns
    -------
    Dict[str, str]
        Mapping of filename -> status_letter

    """
    if new_rev is None:
        new_rev = self.branch
    git_command = ProcessFormatter().format(
        self.GIT_DIFF_FILE_STATUS,
        path=self.folder_path,
        old_rev=old_rev,
        new_rev=new_rev,
    )
    p = await self._run(git_command)

    if p.returncode != 0:
        raise errors.GitDiffError(
            f"Git diff failed for repo at path: {self.folder_path}", git_command
        )

    stdout = p.stdout.strip(b"\t\n\x00 ").decode().split("\x00\t")
    ret = {}

    for filename in stdout:
        status, __, filepath = filename.partition("\x00")  # NUL character
        ret[filepath] = status

    return ret


# Traceback (UnicodeDecodeError)
[ERROR] red: Exception in command 'cog update'
Traceback (most recent call last):
File "c:\__\coding\redenv\lib\site-packages\discord\ext\commands\core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "c:\__\coding\redenv\lib\site-packages\redbot\cogs\downloader\downloader.py", line 885, in _cog_update
await self._cog_update_logic(ctx, cogs=cogs)
File "c:\__\coding\redenv\lib\site-packages\redbot\cogs\downloader\downloader.py", line 979, in _cog_update_logic
updated_cognames, message = await self._update_cogs_and_libs(
File "c:\__\coding\redenv\lib\site-packages\redbot\cogs\downloader\downloader.py", line 1237, in _update_cogs_and_libs
failed_reqs = await self._install_requirements(cogs_to_update)
File "c:\__\coding\redenv\lib\site-packages\redbot\cogs\downloader\downloader.py", line 434, in _install_requirements
if not await repo.install_raw_requirements([req], self.LIB_PATH):
File "c:\__\coding\redenv\lib\site-packages\redbot\cogs\downloader\repo_manager.py", line 931, in install_raw_requirements
p = await self._run(
File "c:\__\coding\redenv\lib\site-packages\redbot\cogs\downloader\repo_manager.py", line 533, in _run
stderr = p.stderr.decode().strip()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 936: invalid continuation byte

# Fixed code
async def _get_file_update_statuses(
    self, old_rev: str, new_rev: Optional[str] = None
) -> Dict[str, str]:
    """
    Gets the file update status letters for each changed file between the two revisions.

    Parameters
    ----------
    old_rev : `str`
        Pre-update revision
    new_rev : `str`, optional
        Post-update revision, defaults to repo's branch if not given

    Returns
    -------
    Dict[str, str]
        Mapping of filename -> status_letter

    """
    if new_rev is None:
        new_rev = self.branch
    git_command = ProcessFormatter().format(
        self.GIT_DIFF_FILE_STATUS,
        path=self.folder_path,
        old_rev=old_rev,
        new_rev=new_rev,
    )
    p = await self._run(git_command)

    if p.returncode != 0:
        raise errors.GitDiffError(
            f"Git diff failed for repo at path: {self.folder_path}", git_command
        )

    stdout = p.stdout.strip(b"\t\n\x00 ").decode(**DECODE_PARAMS).split("\x00\t")
    ret = {}

    for filename in stdout:
        status, __, filepath = filename.partition("\x00")  # NUL character
        ret[filepath] = status

    return ret