zed/crates/action_log/Cargo.toml
Bennet Bo Fenner 1fb920775b
action_log: Accept deleted hunks after commit (#56892)
Sometimes the action log would not auto-accept deleted hunks, and I
finally found a repro for this, here's an explanation of what went wrong

```rust
// Before
use crate::{Alpha, Beta};

fn keep() {
    work();
}

fn remove() {
    work();
}

fn after() {
    work();
}
```

```rust
// After commit
use crate::{Alpha};

fn keep() {
    work();
}

fn after() {
    work();
}
```

The action log may track the deletion as:

```diff
 fn keep() {
     work();
 }

-fn remove() {
-    work();
-}
-
 fn after() {
     work();
 }
```

But the commit diff may choose different boundaries because nearby lines
repeat:

```diff
 fn keep() {
     work();
-}
-
-fn remove() {
-    work();
 }

 fn after() {
     work();
 }
```

Both diffs produce the same final file, but their row ranges differ. The
previous logic only accepted committed edits when those row ranges
matched exactly, so already-committed edits could remain marked as
unaccepted.

Now we have a fast path for checking if the base_text matches exactly,
which works fine in this case.

Release Notes:

- Fixed an issue where agent edits would sometimes not get auto-accepted
when they were commited
2026-05-15 16:27:14 +00:00

51 lines
1.3 KiB
TOML

[package]
name = "action_log"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lib]
path = "src/action_log.rs"
[lints]
workspace = true
[features]
test-support = []
[dependencies]
anyhow.workspace = true
buffer_diff.workspace = true
log.workspace = true
clock.workspace = true
collections.workspace = true
fs.workspace = true
futures.workspace = true
gpui.workspace = true
language.workspace = true
project.workspace = true
telemetry.workspace = true
text.workspace = true
util.workspace = true
watch.workspace = true
[dev-dependencies]
buffer_diff = { workspace = true, features = ["test-support"] }
clock = { workspace = true, features = ["test-support"] }
collections = { workspace = true, features = ["test-support"] }
ctor.workspace = true
git.workspace = true
gpui = { workspace = true, features = ["test-support"] }
indoc.workspace = true
language = { workspace = true, features = ["test-support"] }
log.workspace = true
pretty_assertions.workspace = true
project = { workspace = true, features = ["test-support"] }
rand.workspace = true
serde_json.workspace = true
settings = { workspace = true, features = ["test-support"] }
text = { workspace = true, features = ["test-support"] }
util = { workspace = true, features = ["test-support"] }
zlog.workspace = true