Commit 424f428
fix(openemr-cmd): bind primary .git into worktree containers (#696)
## Summary
- 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 anything that shells out
to git fails — npm husky postinstall, lint-staged, prek, composer
scripts that read commit metadata.
- Bind-mount the primary repo's `.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>/`.
- Restructure the auto-generated override 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. Bumps `openemr-cmd` VERSION 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
- [ ] Generated `easy` override: single `openemr` service block with the
`.git` mount; `mysql` and `couchdb` blocks unchanged
- [ ] Generated `easy-redis` override: single `openemr` block contains
both `.git` and `php.ini` volumes (no duplicate keys); redis-master /
replicas / sentinels emit unchanged
- [ ] Generated `easy-light` override: `openemr` block has only `.git`;
no couchdb / redis blocks
- [ ] All three parse as valid YAML (`python3 -c "import yaml;
yaml.safe_load(...)"`)
- [ ] `openemr-cmd worktree regen <branch>` rewrites an existing
worktree's override correctly
- [ ] After regen + recreate, `openemr-cmd worktree exec <branch> shell`
then `git status` inside the container resolves the repo
- [ ] `npm install` postinstall hooks (husky) succeed inside a worktree
container
- [ ] Existing symlink / path-traversal guards still fire for the prior
mounts (lib_root, env_root, php.ini)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7b2c353 commit 424f428
1 file changed
Lines changed: 43 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
245 | 262 | | |
246 | 263 | | |
247 | 264 | | |
| |||
282 | 299 | | |
283 | 300 | | |
284 | 301 | | |
285 | | - | |
286 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
287 | 312 | | |
288 | 313 | | |
289 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
290 | 330 | | |
291 | 331 | | |
292 | 332 | | |
| |||
310 | 350 | | |
311 | 351 | | |
312 | 352 | | |
313 | | - | |
314 | 353 | | |
315 | 354 | | |
316 | 355 | | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | 356 | | |
322 | 357 | | |
323 | 358 | | |
| |||
0 commit comments