def hardlink_copy_dir(src_dir, dst_dir, **kwargs):
    """Copy a directory recursively using hardlinks. If hardlinking is not possible, use shutil.copy2.

    All kwargs are the same as shutil.copytree except for copy_function which is not supported.
    """
    # TODO(olivedevteam): What if dst_dir is a sub-directory of src_dir?
    # i.e. dst_dir.is_relative_to(src_dir) == True
    # Unsure if even shutil.copytree handles this scenario gracefully!!

    if kwargs.pop("copy_function", None) is not None:
        logger.warning("copy_function is not supported for hardlink_copy_dir. Ignoring.")

    if kwargs.pop("dirs_exist_ok", None) is not None:
        logger.warning("dirs_exist_ok is not supported for hardlink_copy_dir. Ignoring.")

    copy_dir(src_dir, dst_dir, copy_function=hardlink_copy_file, dirs_exist_ok=True, **kwargs)
Copy a directory recursively using hardlinks. If hardlinking is not possible, use shutil.copy2.

    All kwargs are the same as shutil.copytree except for copy_function which is not supported.
    
olive/common/utils.py