Skip to content

feat(git): add worktree branch roots#401

Open
pcristin wants to merge 1 commit into
DeusData:mainfrom
pcristin:codex/351-git-worktree-support
Open

feat(git): add worktree branch roots#401
pcristin wants to merge 1 commit into
DeusData:mainfrom
pcristin:codex/351-git-worktree-support

Conversation

@pcristin
Copy link
Copy Markdown

Summary

Fixes #351.

Adds first-class git worktree awareness by introducing a git context resolver and using branch nodes as the graph root beneath each project:

  • Detect git repos, linked worktrees, detached HEADs, branch slugs, canonical common root, HEAD/base SHAs, and git dirs.
  • Add Project -[:HAS_BRANCH]-> Branch and reparent top-level structural containment to the branch node while preserving existing file/folder/function qualified names.
  • Surface git/worktree metadata in list_projects and index_status.
  • Add focused tests for non-git paths, linked worktrees, branch-root graph shape, and MCP status metadata.

Notes

  • Pure C implementation, no new dependencies.
  • New cbm_popen usage is limited to git metadata lookup and is documented in scripts/security-allowlist.txt.
  • This PR is over the preferred 500-line guideline because it includes the resolver plus regression tests in one issue-scoped change.

Verification

  • make -f Makefile.cbm build/c/test-runner passes.
  • git diff --check passes.
  • Touched files pass clang-format dry-run.
  • scripts/test.sh was run; it fails in existing incremental dump/status tests with final summary 3513 passed, 112 failed, 16 skipped.
  • scripts/lint.sh was run; it fails because cppcheck is not installed locally and because of existing broad clang-tidy findings outside this diff. The diff-specific formatting finding was fixed.

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.

Support efficient indexing for Git worktree-based agent development workflows

1 participant