Conversation
add resolving git aliases add alias resolving tests
There was a problem hiding this comment.
Pull request overview
This PR implements native git alias handling in git-ai by expanding aliases before executing commands, enabling pre-command hooks to match on the resolved command rather than the alias name.
Changes:
- Added alias resolution logic that expands git aliases before running pre-command hooks
- Implemented quote-aware parsing for alias values with proper escape handling
- Added cycle detection to prevent infinite loops in alias chains
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/git_alias_resolution.rs | New test file with comprehensive coverage of alias resolution scenarios including simple aliases, chains, cycles, shell aliases, and quote parsing |
| src/commands/git_handlers.rs | Core implementation of alias resolution and token parsing, plus formatting improvements to post-command hook calls |
| src/git/repository.rs | Documentation enhancement for config_get_regexp method clarifying regex matching behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fn parse_alias_tokens(value: &str) -> Option<Vec<String>> { | ||
| let trimmed = value.trim_start(); | ||
|
|
||
| // If alias starts with '!', it's a shell command,currently proxy to git |
There was a problem hiding this comment.
There is a spelling error in the comment. "currently" should be "currently" with proper spacing. The text should read "it's a shell command, currently proxy to git" with proper spacing after the comma.
| // If alias starts with '!', it's a shell command,currently proxy to git | |
| // If alias starts with '!', it's a shell command, currently proxy to git |
|
Fixes #378 |
|
Thanks for the PR! It's quite late here but I'll review tomorrow -- excited to get this in! |
Added native git aliases handling: