Stage diffs: clean Git files take their baseline from the index blob
On a large Git workspace the 32 MiB retained-text budget was spent alphabetically on files that never change, so small late edits were recorded with no_patch. The stage-start snapshot now keeps text only for files dirty or untracked at start; a clean tracked file keeps its hash and stage-0 index blob id. When it changes or is deleted, the after capture reads that blob in one `git cat-file --batch` and uses it only if its SHA-256 matches the start read, so stage commits/resets do not move the baseline and filters or assume-unchanged never yield a wrong patch. The after capture shares unchanged files' representation instead of spending budget on them again. FileChange gains no_patch_reason (binary, file_size, budget, lines, evidence_size, git_status, baseline). Non-Git workspaces keep their behaviour.
This commit is contained in:
@@ -469,9 +469,15 @@ type FileChange struct {
|
||||
// NoPatch marks a change listed without any patch: the content exceeded the
|
||||
// capture budget (compared by hash) or the change was seen only in Git
|
||||
// status. Truncated is also set so older readers show "patch omitted".
|
||||
NoPatch bool `json:"no_patch,omitempty"`
|
||||
BeforeMode string `json:"before_mode,omitempty"`
|
||||
AfterMode string `json:"after_mode,omitempty"`
|
||||
NoPatch bool `json:"no_patch,omitempty"`
|
||||
// NoPatchReason says why a content change has no (complete) patch:
|
||||
// "binary", "file_size" (text over 1 MiB), "budget" (snapshot text budget),
|
||||
// "lines" (over 5,000 combined lines), "evidence_size" (per-visit retained
|
||||
// evidence limit), "git_status" (seen only in Git status) or "baseline"
|
||||
// (stage-start content unrecoverable). Empty when a patch was recorded.
|
||||
NoPatchReason string `json:"no_patch_reason,omitempty"`
|
||||
BeforeMode string `json:"before_mode,omitempty"`
|
||||
AfterMode string `json:"after_mode,omitempty"`
|
||||
}
|
||||
|
||||
type NotificationReceipt struct {
|
||||
|
||||
Reference in New Issue
Block a user