fuckgit installs as a Cargo bin literally named `git` (via `[[bin]] name = "git"`). When invoked inside a jj worktree by an AI agent, it prints the equivalent `jj` subcommand plus the live `jj help <sub>` output to stderr and exits 2 — the AI sees a clear failure and the right correction. Outside a jj repo, or with no intercept marker, it is a transparent passthrough. The intercept gate fires only when: - effective cwd (after honoring `git -C`) is inside a `.jj` worktree - FUCKGIT_INTERCEPT=1 or an AI marker (CLAUDECODE) is set - subcommand is not on the plumbing allowlist (rev-parse, cat-file, for-each-ref, ...) - GIT_DIR / GIT_EXEC_PATH / CARGO are not set - no top-level --git-dir= / --work-tree= flag is present Otherwise we walk PATH, skip self by canonicalized current_exe(), and exec() the first other `git` we find — preserving signals, exit code, and TTY ownership. Escape hatches: FUCKGIT_PASSTHROUGH=1 env var, --fucking-git flag (stripped before exec). FUCKGIT_DEPTH guard aborts at depth >= 2 to prevent self-recursion. Linux and macOS, zero runtime dependencies.
25 lines
594 B
TOML
25 lines
594 B
TOML
[package]
|
|
name = "fuckgit"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
rust-version = "1.88"
|
|
authors = ["Stephen Waits <steve@waits.net>"]
|
|
description = "A binary named `git` that redirects you to `jj` (Jujutsu) when invoked inside a jj repo."
|
|
license = "MIT"
|
|
readme = "README.md"
|
|
repository = "https://github.com/swaits/fuckgit"
|
|
homepage = "https://github.com/swaits/fuckgit"
|
|
keywords = ["jj", "jujutsu", "git", "vcs"]
|
|
categories = ["command-line-utilities", "development-tools"]
|
|
|
|
[[bin]]
|
|
name = "git"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
|
|
[profile.release]
|
|
lto = "thin"
|
|
strip = true
|
|
codegen-units = 1
|