Skip to content

Worktree snapshots lack object database — git shows "No commits yet" #49

@jhrozek

Description

@jhrozek

Problem

When running an agent in a git worktree workspace, git status inside the VM works without errors but shows "No commits yet" with all files untracked. This is because worktree object databases live in the main repo's .git/objects/, which is outside the workspace and not mounted in the VM.

Current state

As of #48, worktree snapshots have:

  • Sanitized .git/config (readable, credentials stripped)
  • HEAD (symbolic ref from the worktree's gitdir)
  • Empty objects/ and refs/ directories

This is enough for git status to run without errors, but git can't resolve any refs.

Options considered

  1. Mount main repo's .git/objects/ read-only into the VM — gives full history, objects are immutable so read-only mount is safe. Requires wiring the resolved commondir path through sanitizer → VM runner.
  2. Copy pack files — works but expensive for large repos.
  3. Synthetic initial commitgit init && git add . && git commit programmatically. Agent can track its own changes but loses original history.
  4. objects/info/alternates — requires a valid in-VM path to the main repo's objects, so depends on option 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions