C3: chunk staging, unstaging and revert from the gutter and the diff viewer

- crates/vcs chunk.rs: chunks of a file (buffer text vs index, HEAD vs
  index), a minimal patch applied with git apply --cached, revert as a
  byte edit; token refusal when buffer, index or HEAD changed; CRLF
  (autocrlf and stored), no final newline, BOM, staged renames, first
  commit; binary and untracked refused. Real-git tests + property test.
- engine: git.chunks, git.stageChunk, git.unstageChunk, git.revertChunk
  (revert edits the buffer under the lock, undoable in the editor);
  cmd::git::start_then; git.lineChanges shares the vcs line diff.
- UI: chunk popup on a gutter marker click (Stage / Unstage / Revert /
  Previous / Next), hollow staged markers, vcs.showChunk, diff viewer
  hint, "partly staged" badge in the Changes window.
- Docs: G8 row, Git parity row evidence, ui-parity, architecture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-01 12:50:11 +01:00
parent d8e66a4652
commit 301443db7d
28 changed files with 3159 additions and 101 deletions

View file

@ -446,6 +446,12 @@ watch(
:class="`changes__name--${stateColor(row.state)}`"
>{{ baseName(row.file.path) }}</span>
<span class="changes__dir">{{ detail(row) }}</span>
<span
v-if="row.partial"
class="changes__partial"
:title="t('vcs.changes.partlyStaged')"
data-test="changes-row-partial"
>{{ t("vcs.changes.partly") }}</span>
<span class="changes__state">{{ stateLabel(row.state) }}</span>
</div>
</div>
@ -637,6 +643,20 @@ watch(
color: var(--lt-fg-muted);
}
.changes__partial {
flex: none;
margin-left: auto;
padding: 0 4px;
color: var(--lt-fg-muted);
border: 1px solid var(--lt-border);
border-radius: 3px;
font-size: var(--lt-font-size-small);
}
.changes__partial + .changes__state {
margin-left: 6px;
}
.changes__row--selected .changes__dir,
.changes__row--selected .changes__state {
color: var(--lt-fg);