def _check_worktree_support(failhard=True):
    '''
    Ensure that we don't try to operate on worktrees in git < 2.5.0.
    '''
    git_version = version(versioninfo=False)
    if _LooseVersion(git_version) < _LooseVersion('2.5.0'):
        if failhard:
            raise CommandExecutionError(
                'Worktrees are only supported in git 2.5.0 and newer '
                '(detected git version: ' + git_version + ')'
            )
        return False
    return True
Ensure that we don't try to operate on worktrees in git < 2.5.0.