Repository navigation
fix(daemon): ask git for remotes so Suggestions follow includes and insteadOf - #417
Merged
Merged
Conversation
Read the system and global git config files with the repo's, follow include.path and includeIf (gitdir:, gitdir/i:, onbranch:), and rewrite a remote's URL by the longest url.<base>.insteadOf, as git does, still without a git process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spec §3: the config files read, includes and includeIf conditions, insteadOf rewrites, and why the daemon reads them itself instead of running git. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the hand-written git config parser with one `git -C <folder> remote -v` per Pane folder, which applies includes, includeIf and insteadOf itself. No shell, the daemon's environment less GIT_DIR/GIT_WORK_TREE/GIT_COMMON_DIR, killed after 2 s. When git is missing, fails or times out, the repo's own config file is read as before. Spec §3 says why and why nothing is cached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #402
Suggestions now get a Pane folder's remotes by asking
gitdirectly, so includes,includeIfandurl.<base>.insteadOfrewrites all apply. Before, the daemon read only the repo's ownconfigfile, so a remote that only those turn into a GitHub URL got no Suggestion.Approach: ask
git, fall back to the file readergit -C <folder> remote -vonce per Pane folder each time Suggestions are worked out (duplicate folders are collapsed first). The(fetch)lines give each remote's URL after git has applied every config file, include,includeIfandinsteadOfrewrite. A single call covers bothupstreamandorigin, andremote -valready appliesinsteadOf, so nols-remote --get-urlis needed.GIT_DIR,GIT_WORK_TREEandGIT_COMMON_DIRare removed so they can't point git at a different repo. It runs inside the existingspawn_blocking. A reader thread withrecv_timeoutkillsgitafter 2 s.gitis missing, exits non-zero or times out, the daemon uses the previous reader, which reads the repo'sconfigfile directly. It is kept asremotes/file.rsand still handles repo discovery, worktrees andgitdir:files.gitcall per Pane folder each time is cheap and never goes stale after a config edit.No route, field or message changed, so
API_VERSIONstays the same. Spec §3 Suggestions is rewritten.Code
agentdeckd/src/suggestions/remotes/mod.rs:Git(program and timeout),repository_of(asks git first, reads the file on any failure), andpick.remotes/git.rs: runsgit remote -vwith the timeout and parses its output, including a partial clone's[filter]suffix and remotes without a URL.remotes/file.rs: the previous reader, unchanged apart from now returning the remote URLs.Tests
git remote -voutput; agitthat isn't there;repository_offalling back to the config file whengitcan't start; the upstream/origin pick; the file reader's existing cases. No unit test runs a realgit, so the developer's config can't leak in.suggestions.rsgit_config): each puts a Pane in a repo and expects the Suggestion:insteadOf, a repoinsteadOf, a remote from aninclude.pathfile, a globalincludeIf gitdir:that matches one repo and not another, and a worktree whose main repo's remote is rewritten. Each fixture is also checked with realgit remote get-url. The daemon runs with an isolatedHOME/XDG_CONFIG_HOMEandGIT_CONFIG_NOSYSTEM.PATHwithoutgit, and a stubgitthat hangs (killed after 2 s).cargo xtask cipasses locally.🤖 Generated with Claude Code