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:
: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:
parent
d8e66a4652
commit
301443db7d
28 changed files with 3159 additions and 101 deletions
|
|
@ -38,7 +38,16 @@ class FakeEngine implements GitGutterTransport {
|
|||
/** Whether to hold answers until released. */
|
||||
hold = false;
|
||||
|
||||
/** The params of every `git.chunks` query, in order. */
|
||||
readonly chunkCalls: JsonValue[] = [];
|
||||
/** What `git.chunks` answers; null fails it. */
|
||||
chunks: unknown = null;
|
||||
|
||||
query(command: string, params: JsonValue): Promise<{ ok: true; value: unknown } | { ok: false }> {
|
||||
if (command === "git.chunks") {
|
||||
this.chunkCalls.push(params);
|
||||
return Promise.resolve(this.chunks === null ? { ok: false } : { ok: true, value: this.chunks });
|
||||
}
|
||||
expect(command).toBe("git.lineChanges");
|
||||
this.calls.push(params);
|
||||
const answer = this.answer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue