# Buggy code
def update(self):
    """
    Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
    on the call's success.
    """

    # update remote origin url
    self.update_remote_origin()

    # remove untracked files and performs a hard reset on git branch to avoid update issues
    if self._is_hard_reset_allowed():
        # self.clean() # This is removing user data and backups
        self.reset()

    if self.branch == self._find_installed_branch():
        _, _, exit_status = self._run_git(
            self._git_path, "pull -f %s %s" % (sickbeard.GIT_REMOTE, self.branch)
        )  # @UnusedVariable
    else:
        _, _, exit_status = self._run_git(
            self._git_path, "checkout -f " + self.branch
        )  # @UnusedVariable

    if exit_status == 0:
        self._find_installed_version()
        # Notify update successful
        if sickbeard.NOTIFY_ON_UPDATE:
            try:
                notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH or "")
            except Exception:
                logger.log(
                    "Unable to send update notification. Continuing the update process",
                    logger.DEBUG,
                )
        return True

    else:
        return False


# Traceback (ValueError)
2016-09-09 01:16:34 WARNING  FINDSUBTITLES :: [fd8acdd] Unexpected error in provider 'legendastv', discarding it
Traceback (most recent call last):
File "/usr/local/sickbeard-custom/var/SickBeard/lib/subliminal/core.py", line 171, in download_subtitle
self[subtitle.provider_name].download_subtitle(subtitle)
File "/usr/local/sickbeard-custom/var/SickBeard/lib/subliminal/providers/legendastv.py", line 448, in download_subtitle
subtitle.content = fix_line_ending(subtitle.archive.content.read(subtitle.name))
File "/usr/local/sickbeard-custom/var/SickBeard/lib/rarfile/__init__.py", line 657, in read
File "/usr/local/sickbeard-custom/var/SickBeard/lib/rarfile/__init__.py", line 642, in open
File "/usr/local/sickbeard-custom/var/SickBeard/lib/rarfile/__init__.py", line 1189, in _open_unrar
ValueError: Cannot use unrar directly on memory buffer

# Fixed code
def update(self):
    """
    Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
    on the call's success.
    """

    # update remote origin url
    self.update_remote_origin()

    # remove untracked files and performs a hard reset on git branch to avoid update issues
    if self._is_hard_reset_allowed():
        self.clean()
        self.reset()

    if self.branch == self._find_installed_branch():
        _, _, exit_status = self._run_git(
            self._git_path, "pull -f %s %s" % (sickbeard.GIT_REMOTE, self.branch)
        )  # @UnusedVariable
    else:
        _, _, exit_status = self._run_git(
            self._git_path, "checkout -f " + self.branch
        )  # @UnusedVariable

    if exit_status == 0:
        self._find_installed_version()
        # Notify update successful
        if sickbeard.NOTIFY_ON_UPDATE:
            try:
                notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH or "")
            except Exception:
                logger.log(
                    "Unable to send update notification. Continuing the update process",
                    logger.DEBUG,
                )
        return True

    else:
        return False