Skip to content

Fix Docker builds for git worktrees#83

Open
andrewleech wants to merge 1 commit intomattytrentini:mainfrom
andrewleech:worktrees
Open

Fix Docker builds for git worktrees#83
andrewleech wants to merge 1 commit intomattytrentini:mainfrom
andrewleech:worktrees

Conversation

@andrewleech
Copy link
Copy Markdown
Contributor

Summary

  • Adds support for building MicroPython from git worktrees
  • Detects when .git is a file (worktree) vs directory (regular repo)
  • Mounts the main .git directory in Docker container for worktree builds

Problem

When building from a git worktree, mpbuild fails with error:

fatal: not a git repository: /path/to/.git/worktrees/name
make: *** [../../py/mkrules.mk:269: submodules] Error 128

Solution

The Docker container now properly mounts the main .git directory (e.g., /home/user/repo/.git) instead of the worktree-specific path (e.g., /home/user/repo/.git/worktrees/name), giving the container access to the full git repository data needed for submodule updates and version calculations.

Test plan

  • Test with regular git repository (no regression)
  • Test with git worktree setup
  • Verify Docker command includes proper volume mount

🤖 Generated with Claude Code

When building from a git worktree, the .git file contains a path to the actual
.git directory. The Docker container needs access to the main .git directory
to properly resolve git information and update submodules.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant