Skip to content

config show / doctor resolve config to the primary checkout, not the current worktree #152

Description

@JordanCoin

Version: 4.4.2 (Homebrew) · macOS

Summary

Run from a git worktree, config resolution uses the shared git dir and reports the primary checkout's config path, while scanning correctly uses the worktree. The two disagree.

Repro

git worktree add --detach /tmp/wt <sha>
cd /tmp/wt
codemap config show

Actual

No config file found.
Run 'codemap config init' to create /path/to/PRIMARY/checkout/.codemap/config.json

…while codemap context from the same directory correctly reports /tmp/wt as the root.

Cause

Config resolution appears to use git rev-parse --git-common-dir, which is deliberately shared across worktrees, rather than --show-toplevel.

Impact

  • config show reports on a directory you are not in.
  • config init from a worktree would write into a different checkout — surprising, and potentially a dirty file in someone else's working tree.
  • Scan and config disagree, so per-project excludes may or may not apply depending on which entry point you came through.

Suggested fix

Use git rev-parse --show-toplevel for config resolution so it matches the tree being scanned. If sharing config across worktrees is intentional, say so in config show's output and never write outside the current toplevel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions