Skip to content

Feat/handle git alias#435

Open
bernoussama wants to merge 2 commits intogit-ai-project:mainfrom
bernoussama:feat/handle-git-alias
Open

Feat/handle git alias#435
bernoussama wants to merge 2 commits intogit-ai-project:mainfrom
bernoussama:feat/handle-git-alias

Conversation

@bernoussama
Copy link
Contributor

Added native git aliases handling:

  • expand alias before executing to match on pre command hooks first
  • fallback to git

add resolving git aliases
add alias resolving tests
Copilot AI review requested due to automatic review settings February 1, 2026 14:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// 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

Copilot uses AI. Check for mistakes.
@bernoussama
Copy link
Contributor Author

Fixes #378

@svarlamov
Copy link
Member

Thanks for the PR! It's quite late here but I'll review tomorrow -- excited to get this in!

@svarlamov svarlamov self-assigned this Feb 3, 2026
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