Replies: 3 comments 1 reply
|
I would agree with new worktree = new setup. Especially with Magento environments, having the shared resources across worktrees could lead to some odd issues (like database schema changes / updates, caching, etc). I think having things default to current environment folder name makes sense (at least to me) and you can override it if you want. Would make |
|
I've been thinking about this some more today, and am wondering if it would be as simple as a flag like
I think this would satisfy most use cases and (hopefully?) be a fairly straight-forward addition. |
|
For my use case, I don't think anything needs to be changed on the Warden side for now. I've built a custom script that replaces a couple of environment variables and builds the project, which works well for my setup. At most, I could see something like a However, I think this could quickly grow into a fairly complex feature that needs to be highly customizable:
For example, my custom script also supports copying a database directly between Docker volumes and applying additional fixtures after the copy. Another complication I've encountered is Git integration. Some of my tests depend on Git metadata, and I also use Git hooks. With linked worktrees, .git is normally a file pointing to metadata stored elsewhere, which can cause problems when only the worktree directory is mounted into a container. There are several ways around this, but none seem particularly clean or universal. In some cases, simply cloning the repository into another directory might be easier than using Git worktrees at all. This also overlaps with environment-specific decisions. For example, some macOS development environments using Mutagen exclude .git from synchronization, creating similar limitations even without worktrees. Once we start covering these use cases, it's no longer just a simple I'd suggest keeping this outside Warden core, potentially as an optional plugin or a standalone wrapper around Warden. We could also look at how projects like DDEV handle customizable lifecycle hooks and project-specific automation. In this article: https://ddev.com/blog/git-worktree-contributor-training/ DDEV litteraly have a block of custom code to move DB from one worktree to another For now, I'd probably suggest doing nothing in Warden core unless we identify a small, generic capability that's genuinely missing and would benefit multiple workflows. Also most of work now is done with AI agent, for them worktrees are native thing they only need a few instructions on how to build and run project after worktree created. |
Uh oh!
There was an error while loading. Please reload this page.
I'm starting to explore how to use git worktrees, and thinking of how working with Warden in them could be made a little easier.
My first thought is that we essentially would want a way to base
WARDEN_ENV_NAMEandTRAEFIK_DOMAINon a variable (like the folder name) and the rest would fall into place. I don't think we'll ever be able to avoid the new worktree = new setup, but at least being able to keep the same.envbetween branches would be nice, in my mind.All reactions