# git: Add create git worktree hook to task system \(\#51337\) · gitcafe/zed

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

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

Visibility: public

Requested revision: efb12d27219c25b741a234f1fef920a6c460dd6e

Requested commit: efb12d27219c25b741a234f1fef920a6c460dd6e

Commit: efb12d27219c25b741a234f1fef920a6c460dd6e

Tree: 39c1f280b00e2065475904a6ef395bf026221ead

Author: Anthony Eid

Committer: GitHub

## Message

```
git: Add create git worktree hook to task system (#51337)

### Summary

This PR starts work on adding basic hook support in the `TaskStore`. To
enable users to setup tasks that are ran when the agent panel creates a
new git worktree to start a thread in. It also adds a new task variable
called `ZED_MAIN_GIT_WORKTREE` that's the absolute path to the main repo
that the newly created linked worktree is based off of.

### Follow Ups 

- Get this hook working with the git worktree picker as well
- Make a more general approach to the hook system in `TaskStore`
- Add `ZED_PORT_{1..10}` task variables
- Migrate the task context creation code from `task_ui` to the basic
context provider

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
```

## Parents

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

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