INNER CODE UNIT · Python

_truncate_diff

dotnet/sdk · .github/scripts/check_vendored_files.py:235

def _truncate_diff(diff_lines: list[str], max_lines: int) -> str:
    if len(diff_lines) <= max_lines:
        return "".join(diff_lines)
    head = "".join(diff_lines[:max_lines])
    return f"{head}\n... (diff truncated; {len(diff_lines) - max_lines} more lines)"


def check_source(entry: Entry, source_index: int, source: Source) -> DriftResult:
    status, current_blob_sha = _get_blob_sha(source.repo, source.ref, source.path)

    if status == 404:
        return DriftResult(
            entry=entry, source_index=source_index, source=source,
            status="missing", current_blob_sha=None, current_ref_sha=None,
            detail=(
                f"Upstream path `{source.path}` no longer exists on "
                f"`{source.repo}@{source.ref}`. The file may have been renamed, "
                f"deleted, or the tracked ref was renamed."

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…