Consolidate git repository helper functions into centralized utilities#6876
Merged
Conversation
- Move git repository URL parsing to centralized parseGitHubRepoSlugFromURL in git.go - Add findGitRootForPath for finding git root from any file path - Add getRepositorySlugFromRemote and getRepositorySlugFromRemoteForPath helpers - Refactor compile_orchestrator.go to use centralized helpers - Refactor devcontainer.go to use centralized helpers - Add comprehensive unit tests for new helper functions - Remove unused imports and deprecated wrapper functions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor function to resolve git repository information
Consolidate git repository helper functions into centralized utilities
Dec 18, 2025
Collaborator
|
@copilot remove wrappers |
- Remove getRepositorySlug(), getRepositorySlugForPath(), getRepositoryRoot(), getRepositoryRootForPath() wrappers from compile_orchestrator.go - Update all callers to use centralized functions directly: - getRepositorySlugFromRemote() instead of getRepositorySlug() - getRepositorySlugFromRemoteForPath() instead of getRepositorySlugForPath() - findGitRoot() instead of getRepositoryRoot() - findGitRootForPath() instead of getRepositoryRootForPath() - Updated files: compile_orchestrator.go, compile_validation.go, compile_orchestrator_stability_test.go Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
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.
Duplicate git repository information resolution logic was scattered across
compile_orchestrator.go,devcontainer.go, andgit.go, with each implementing its own URL parsing and git root finding.Changes
Centralized helpers in
git.go:parseGitHubRepoSlugFromURL()- Parses GitHub URLs (HTTPS/SSH) to extract owner/repogetRepositorySlugFromRemote()- Extracts slug from current directory's remotegetRepositorySlugFromRemoteForPath(path)- Extracts slug for specific file pathsfindGitRootForPath(path)- Finds git root containing a fileRefactored consumers:
compile_orchestrator.go: Removed wrapper functions, all code now directly calls centralized helperscompile_validation.go: Updated to use centralized helpers directlycompile_orchestrator_stability_test.go: Updated to use centralized helpers directlydevcontainer.go: UpdatedgetCurrentRepoName()andgetRepoOwner()to use centralized functionsExample:
Before:
After:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.