kosiew opened a new issue, #26101:
URL: https://github.com/apache/datafusion/issues/26101

   ## Problem
   
   #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:
   
   ```sh
   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:
   
   ```sh
   # .envrc
   use flake
   source_env_if_exists .envrc.local
   ```
   
   ```gitignore
   # .gitignore
   .envrc.local
   ```
   
   Optionally add a short note to the
   [development environment 
guide](docs/source/contributor-guide/development_environment.md)
   describing the Nix/direnv setup and `.envrc.local` for personal settings.
   
   ## Scope
   
   ### In
   
   - Add `source_env_if_exists .envrc.local` to `.envrc`.
   - Add `.envrc.local` to `.gitignore`.
   - Brief contributor-guide note (optional).
   
   ### Out
   
   - Changes to `flake.nix` / `flake.lock`.
   - Removing the tracked `.envrc` or the Nix support added in #26005.
   
   ## Acceptance criteria
   
   - [ ] With Nix + direnv, entering the repo still loads the flake dev shell.
   - [ ] A `.envrc.local` in the repo root is sourced by direnv after `use 
flake`.
   - [ ] `git status` does not show `.envrc.local`, and `git switch` /
         `git pull` never modify it.
   
   ## Tests / verification
   
   - Manual: create `.envrc.local` with `export FOO=1`, run `direnv allow`,
     confirm `echo $FOO` prints `1` and `git status` is clean.
   - Manual: switch between commits before and after the change; confirm
     `.envrc.local` is untouched.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to