You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tracked .envrc from #26005 silently overwrites contributors' local direnv config #26101
#26005 added a tracked .envrc (use flake). Before that change .envrc was
not tracked, so contributors who use direnv kept their own local .envrc
(e.g. CARGO_TARGET_DIR, CARGO_INCREMENTAL, helper exports). Since .envrc is a common entry in global gitignores and .git/info/exclude, many
of these files are ignored rather than untracked.
Git treats ignored files as expendable, so updating to a commit that tracks .envrc replaces the local file without any warning:
echo'export CARGO_TARGET_DIR=/tmp/df-target'> .envrc
echo .envrc >> .git/info/exclude
git switch main # any commit including #26005
cat .envrc # -> "use flake"; local config is gone
Contributors whose .envrc is untracked but not ignored instead get error: The following untracked working tree files would be overwritten by checkout: .envrc and have to move the file aside by hand.
Why it matters
Silent loss of local developer config on git pull / git switch.
No supported place for per-contributor direnv settings: editing the tracked .envrc leaves a dirty tree that blocks branch switches and is easy to
commit by accident in a PR.
Contributors who do not use Nix but do use direnv now get a use flake .envrc they cannot use as-is.
Invariant / desired behavior
Nix users still get the dev shell from the tracked .envrc with no extra
steps.
Contributors can keep personal direnv settings in an ignored file that git
never overwrites, and that is loaded automatically.
Proposed direction
Use the standard direnv local-override pattern:
# .envrc
use flake
source_env_if_exists .envrc.local
# .gitignore.envrc.local
Optionally add a short note to the development environment guide
describing the Nix/direnv setup and .envrc.local for personal settings.
Activity
fix: preserve local direnv settings (apache#26122)
fix: preserve local direnv settings (apache#26122)