def entry_at(cls, filepath: PathLike, index: int) -> "RefLogEntry":
        """
        :return:
            :class:`RefLogEntry` at the given index.

        :param filepath:
            Full path to the index file from which to read the entry.

        :param index:
            Python list compatible index, i.e. it may be negative to specify an entry
            counted from the end of the list.

        :raise IndexError:
            If the entry didn't exist.

        :note:
            This method is faster as it only parses the entry at index, skipping all
            other lines. Nonetheless, the whole file has to be read if the index is
            negative.
        """
        with open(filepath, "rb") as fp:
            if index < 0:
                return RefLogEntry.from_line(fp.readlines()[index].strip())
            # Read until index is reached.

            for i in range(index + 1):
                line = fp.readline()
                if not line:
                    raise IndexError(f"Index file ended at line {i + 1}, before given index was reached")
                # END abort on eof
            # END handle runup

            return RefLogEntry.from_line(line.strip())
        # END handle index

        :return:
            :class:`RefLogEntry` at the given index.

        :param filepath:
            Full path to the index file from which to read the entry.

        :param index:
            Python list compatible index, i.e. it may be negative to specify an entry
            counted from the end of the list.

        :raise IndexError:
            If the entry didn't exist.

        :note:
            This method is faster as it only parses the entry at index, skipping all
            other lines. Nonetheless, the whole file has to be read if the index is
            negative.
        
git/refs/log.py