Skip to content

fix: normalize "." repo identifier to auto-detect#8

Merged
philpennock merged 1 commit into
mainfrom
claude/fix-dot-repo-access-control
Apr 3, 2026
Merged

fix: normalize "." repo identifier to auto-detect#8
philpennock merged 1 commit into
mainfrom
claude/fix-dot-repo-access-control

Conversation

@philpennock
Copy link
Copy Markdown
Member

Summary

  • Normalize "." to "" (auto-detect) in openGitRepo, the single chokepoint for all git operations
  • aifr log . now behaves identically to aifr log — no access control check since the user is already in the directory
  • ".." and other relative paths are NOT normalized and remain subject to access control

Background

When running aifr log . the repo identifier "." was treated as an explicit filesystem path, triggering access control checks. This caused aifr log . to be denied even though aifr log (no argument, auto-detect) succeeded from the same directory. The fix applies to all git commands (log, refs, rev-parse, reflog, stash-list, git-config) since they all go through openGitRepo.

Test plan

  • TestOpenGitRepoDotNormalization — verifies "" and "." succeed, absolute path denied, ".." denied
  • TestDotRepoConsistentAcrossCommands — verifies "." works for Refs and Log, absolute paths denied
  • All existing tests pass (go test -race ./...)

https://claude.ai/code/session_016QBk2VFvP92AXspnSePeLz

When a user passes "." as a repo identifier (e.g., `aifr log .`,
`aifr refs .`, `aifr stash-list .`), it means "this directory" —
semantically identical to the no-argument auto-detect case. Previously,
"." was treated as an explicit filesystem path and subjected to access
control on the repo root, causing it to be denied when the auto-detect
path (empty string) would succeed for the same repo.

Fix by normalizing "." to "" at the top of openGitRepo, the single
chokepoint for all git operations. This applies consistently to all
git commands (log, refs, stash-list, rev-parse, git-config) without
touching any individual command's arg parsing.

".." and other relative paths ("./sub", "../other") remain subject
to access control since they may reference a different repository.

https://claude.ai/code/session_016QBk2VFvP92AXspnSePeLz
@philpennock philpennock merged commit e7205d0 into main Apr 3, 2026
6 checks passed
@philpennock philpennock deleted the claude/fix-dot-repo-access-control branch April 3, 2026 10:09
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.

2 participants