fix(openemr-cmd): bind primary .git into worktree containers#696
Open
bradymiller wants to merge 2 commits intoopenemr:masterfrom
Open
fix(openemr-cmd): bind primary .git into worktree containers#696bradymiller wants to merge 2 commits intoopenemr:masterfrom
bradymiller wants to merge 2 commits intoopenemr:masterfrom
Conversation
In a linked worktree, .git is a text pointer to an absolute host path inside the primary repo's .git/worktrees/<slug>; that path does not exist inside the worktree's container, so any tool that shells out to git fails (npm husky, lint-staged, prek, composer scripts that read commit metadata). Bind-mount the primary repo's .git directory at the same absolute path inside the worktree's openemr container so the existing pointer resolves transparently. Mounted RW because git writes refs, indexes, packed objects, and the worktree-specific state under .git/worktrees/<slug>/. Restructure the override emission so the openemr service block is always present (previously only emitted for easy-redis), with the redis-only php.ini volume appended into that same block to avoid duplicate YAML keys. Bump VERSION to 1.0.30. Existing worktrees pick up the new mount via 'openemr-cmd worktree regen <branch>' followed by container recreation (worktree down --keep-volumes + worktree up). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates openemr-cmd’s worktree override generation so linked worktree containers can successfully resolve Git metadata by bind-mounting the primary repo’s .git directory at the same absolute host path inside the container. It also restructures the generated override YAML so the openemr service block is always emitted (and the easy-redis php.ini mount is appended into that same block), and bumps the script version.
Changes:
- Bind-mount the primary repo’s
.gitdirectory into worktree containers to fix Git-dependent tooling inside containers. - Restructure generated
docker-compose.override.ymloutput to always include a singleopenemrservice block (avoids duplicate YAML keys foreasy-redis). - Bump
openemr-cmdversion to1.0.30.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fi | ||
|
|
||
| # Resolve the primary repo's .git directory. The worktree's own .git is a | ||
| # text file containing 'gitdir: <absolute-host-path-to-primary-.git/worktrees/<slug>>'. |
git uses the worktree directory's basename (here "openemr-wt-<slug>") as the per-worktree subdir under <primary>/.git/worktrees/, not the branch slug alone. The original comment elided the prefix and could mislead future maintainers. Comment-only change; no functional impact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.gitis a text pointer to an absolute host path inside the primary repo's.git/worktrees/<slug>. That path does not exist inside the worktree's container, so anything that shells out to git fails — npm husky postinstall, lint-staged, prek, composer scripts that read commit metadata..git/at the same absolute host path inside the worktree's openemr container so the existing pointer resolves transparently. RW because git writes refs, indexes, packed objects, and the worktree-specific state under.git/worktrees/<slug>/.openemrservice block is always present (previously only emitted foreasy-redis), with the redis-onlyphp.inivolume appended into that same block to avoid duplicate YAML keys. Bumpsopenemr-cmdVERSION to 1.0.30.After this change, existing worktrees pick up the new mount via
openemr-cmd worktree regen <branch>followed by container recreation (worktree down --keep-volumes <branch>+worktree up <branch>).Test plan
easyoverride: singleopenemrservice block with the.gitmount;mysqlandcouchdbblocks unchangedeasy-redisoverride: singleopenemrblock contains both.gitandphp.inivolumes (no duplicate keys); redis-master / replicas / sentinels emit unchangedeasy-lightoverride:openemrblock has only.git; no couchdb / redis blockspython3 -c "import yaml; yaml.safe_load(...)")openemr-cmd worktree regen <branch>rewrites an existing worktree's override correctlyopenemr-cmd worktree exec <branch> shellthengit statusinside the container resolves the reponpm installpostinstall hooks (husky) succeed inside a worktree container🤖 Generated with Claude Code