Skip to content

fix(cli): resolve default project to main repo name in git worktrees - #48

Open
techkayacodes wants to merge 1 commit into
MaxonT:mainfrom
techkayacodes:fix/worktree-default-project
Open

techkayacodes wants to merge 1 commit into
MaxonT:mainfrom
techkayacodes:fix/worktree-default-project

Conversation

@techkayacodes

Copy link
Copy Markdown
Contributor

Resolves _default_project() to the main repository name when invoked from inside a linked git worktree.

Problem

git rev-parse --show-toplevel returns the worktree directory path (for example wt-session-123), so aisync log and aisync claim recorded the worktree directory name instead of the main repository name.

Changes

  • Query git rev-parse --git-common-dir first in _default_project() (ai_sync/cli.py), resolving <main-repo>/.git to its parent directory name (common.parent.name), with a fallback to --show-toplevel for non-standard layouts.
  • Add DefaultProjectTests in tests/test_ai_sync.py covering the main checkout, nested subdirectories, linked git worktrees, worktree subdirectories, and non-git directories.

Closes #35

This branch has not been deployed

No deployments
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.

claim: in a git worktree the default project is the worktree directory, so claims do not meet the main checkout's

1 participant