def METHOD_NAME(self, statepath: str, logger: Logger) -> bool:
    r = Runner(logger=logger, cwd=statepath)
    old_url = r.get('git', 'remote', 'get-url', 'origin').strip()
    old_branch = r.get('git', 'rev-parse', '--abbrev-ref', 'HEAD').strip()
    need_refetch = False
    if old_url != self._url:
        logger.log(f'repository URL has changed {old_url} -> {self._url}, will clone from scratch')
        need_refetch = True
    if old_branch != self._branch:
        logger.log(f'repository branch has changed {old_branch} -> {self._branch}, will clone from scratch')
        need_refetch = True
    if need_refetch:
        shutil.rmtree(statepath)
        return self._do_fetch(statepath, logger)
    old_head = r.get('git', 'rev-parse', 'HEAD').strip()
    r.run('timeout', self._timeout_arg, 'git', 'fetch', '--progress', self._depth_arg)
    r.run('git', 'checkout')  # needed for reset to not fail on changed sparse checkout
    self._setup_sparse_checkout(statepath)
    r.run('git', 'reset', '--hard', f'origin/{self._branch}')
    r.run('git', 'reflog', 'expire', '--expire=0', '--all')
    r.run('git', 'prune')
    new_head = r.get('git', 'rev-parse', 'HEAD').strip()
    if new_head == old_head:
        logger.log('HEAD has not changed: {}'.format(new_head))
        return False
    logger.log('HEAD was updated from {} to {}'.format(old_head, new_head))
    return True