# action_log: Accept deleted hunks after commit \(\#56892\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/1fb920775b14a7d29fc25a85c22beae919537f3a)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 1fb920775b14a7d29fc25a85c22beae919537f3a

Requested commit: 1fb920775b14a7d29fc25a85c22beae919537f3a

Commit: 1fb920775b14a7d29fc25a85c22beae919537f3a

Tree: 16dc6502bba2fc978b8ff2975d9dbec523bf520c

Author: Bennet Bo Fenner

Committer: GitHub

## Message

````
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
````

## Parents

- [3a742b5e0d7681524db55a625a4980dec40012a8](https://git.cafe/gitcafe/zed/commit/3a742b5e0d7681524db55a625a4980dec40012a8?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/1fb920775b14a7d29fc25a85c22beae919537f3a?format=markdown)
