# assistant_tool: Fix rejecting edits deletes newly created and accepted files \(\#35622\) · gitcafe/zed

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

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

Visibility: public

Requested revision: a9c44ac5511dc55239c7d125252a613e872844d0

Requested commit: a9c44ac5511dc55239c7d125252a613e872844d0

Commit: a9c44ac5511dc55239c7d125252a613e872844d0

Tree: e6fa0aca9ac624f662549a4bbb3afa9b941e8602

Author: Smit Barmase

Committer: GitHub

## Message

```
assistant_tool: Fix rejecting edits deletes newly created and accepted files (#35622)

Closes #34108
Closes #33234

This PR fixes a bug where a file remained in a Created state after
accept, causing following reject actions to incorrectly delete the file
instead of reverting back to previous state. Now it changes it to
Modified state upon "Accept All" and "Accept Hunk" (when all edits are
accepted).

- [x] Tests

Release Notes:

- Fixed issue where rejecting AI edits on newly created files would
delete the file instead of reverting to previous accepted state.
```

## Parents

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

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