Native Git Diff Driver
In v0.5.0, symtrace’s git-diff-driver subcommand operates with full repository context-awareness and Two-Tier CAS Diff Caching. When Git invokes external diff drivers on temporary files, symtrace resolves local repository context to preserve cross-file symbol movement tracking, downstream blast radius calculation, and .scm query DSL evaluation.
git diff ──► .gitattributes filter ──► symtrace git-diff-driver ──► Context-Aware AST DiffSetup Instructions
Section titled “Setup Instructions”Step 1: Configure Git Driver Command
Section titled “Step 1: Configure Git Driver Command”# Global configuration (applies to all Git repositories)git config --global diff.symtrace.command "symtrace git-diff-driver"
# OR local configuration (applies only to current repository)git config diff.symtrace.command "symtrace git-diff-driver"Step 2: Assign Driver in .gitattributes
Section titled “Step 2: Assign Driver in .gitattributes”In your repository root, add or update your .gitattributes file:
# Map supported language files to symtrace semantic diff*.rs diff=symtrace*.js diff=symtrace*.jsx diff=symtrace*.ts diff=symtrace*.tsx diff=symtrace*.py diff=symtrace*.java diff=symtrace*.c diff=symtrace*.h diff=symtrace*.cpp diff=symtrace*.hpp diff=symtrace*.go diff=symtrace*.cs diff=symtrace*.rb diff=symtrace*.php diff=symtrace*.json diff=symtraceHow It Works Under the Hood
Section titled “How It Works Under the Hood”When you execute standard Git commands like git diff, Git inspects .gitattributes. When a file matches a rule with diff=symtrace, Git executes the driver command with 7 positional arguments:
symtrace git-diff-driver <path> <old-file> <old-hex> <old-mode> <new-file> <new-hex> <new-mode>In v0.5.0, the git-diff-driver subcommand:
- Resolves local Git repository state from
<path>to re-establish global context. - Queries the Two-Tier CAS Diff Cache keyed by
<old-hex>and<new-hex>for under 0.004 ms execution. - Performs 6-stage AST matching, safety contract checking, and custom
.scmquery DSL evaluation. - Outputs formatted ANSI semantic badges with adaptive granularity directly to Git’s standard pager pipeline.
Usage Examples
Section titled “Usage Examples”# Show semantic diff of modified files in working treegit diff
# Show semantic diff of staged filesgit diff --staged
# Show semantic diff between two commits or branchesgit diff main feature-branch
# Bypass git-diff-driver and force raw line diff for one commandgit diff --no-ext-diff