mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
75e8b78cc7
The oversized preflight in buildBoundedTrackedDiff mapped every object the cat-file batch could not size to infinity. `missing` is routine: for tree-vs-worktree diffs git hashes the WORKING-TREE content of any path pulled into rename/copy detection and prints that hash in --raw output without ever writing the blob, and partial clones report it for unfetched blobs. Those files were excluded by pathspec and replaced with a contents-free binary stub, so a renamed-and-edited file rendered as a silently empty card and /api/file-content refused it as binary. Missing now means unknown, not oversized, and an unreadable new side is bounded by the working-tree file's stat size instead. Every rendered diff stays bounded git-side by core.bigFileThreshold (#1205), genuinely oversized files still stub via real probe sizes plus the stat door, and a blob git truly cannot read now fails loudly through assertGitSuccess instead of blanking a file. Client side, a chunk with a binary marker and no hunks now renders an explicit placeholder in both the all-files view and the single-file viewer, so an empty card can never again pass for "no changes here". AI-assisted.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import React, { useLayoutEffect } from 'react';
|
|
|
|
/**
|
|
* Says why a file's card has no diff in it.
|
|
*
|
|
* A patch chunk with a binary marker and no hunks renders as an empty body:
|
|
* the card is a bare header with no counts and no reason, which reads as a
|
|
* broken diff. That shape covers genuine binary files and files the review
|
|
* core declined to read, so the copy commits to neither cause.
|
|
*/
|
|
export const BinaryFileNotice: React.FC<{
|
|
/** Re-measure hook for the virtualized all-files host, whose custom-header
|
|
* slot heights are not auto-observed. */
|
|
onHeightChange?: () => void;
|
|
}> = ({ onHeightChange }) => {
|
|
// Before paint, so the host re-measures without a one-frame overlap with the
|
|
// content below.
|
|
useLayoutEffect(() => {
|
|
onHeightChange?.();
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
return (
|
|
<div
|
|
data-binary-file-notice=""
|
|
className="px-4 py-2 text-xs leading-relaxed text-muted-foreground border-b border-border bg-muted/30"
|
|
>
|
|
Binary or oversized file, content not shown.
|
|
</div>
|
|
);
|
|
};
|