def cleanup_git_worktree(self, worktree_path, pack_name, content_version):
        """
        Remove / cleanup the provided git worktree directory.

        :rtype: ``bool``
        """
        # Safety check to make sure we don't remove something outside /tmp
        if not worktree_path.startswith("/tmp"):
            raise ValueError(
                f"The worktree path is not within /tmp (was {type(worktree_path)})."
            )
        if not worktree_path.startswith("/tmp/%s" % (self.WORKTREE_DIRECTORY_PREFIX)):
            raise ValueError(
                f"The worktree path is not within /tmp/ (was {type(worktree_path)})."
            )

        if self._debug:
            LOG.debug(
                'Not removing git worktree "%s" because debug mode is enabled'
                % (worktree_path)
            )
        else:
            LOG.debug(
                'Removing git worktree "%s" for pack "%s" and content version "%s"'
                % (worktree_path, pack_name, content_version)
            )

            try:
                shutil.rmtree(worktree_path, ignore_errors=True)
            except Exception:
                msg = "Unable to remove / cleanup the provided git worktree directory."
                LOG.exception(msg)

        return True

        Remove / cleanup the provided git worktree directory.

        :rtype: ``bool``
        
st2common/st2common/runners/base.py