-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't prompt to allow if user explicitly denied (#1158)
Currently if an `Allow` check fails direnv will prompt the user to `direnv allow` the file. However, `direnv` will do that even if the user explicitly ran a `direnv deny` command, which is not necessarily the desired behavior. In particular, a user might have `direnv` installed and enabled but might not wish to enable the `.envrc` file for every repository that they interact with. However, currently `direnv` will always prompt the user to `direnv allow` every time they `cd` into a repository with a `.envrc` file. This fixes that by recording when the user explicitly denied a `.envrc` file so that `direnv` knows not to prompt again. There is one key difference between how `direnv allow` and `direnv deny` record the hash. `direnv allow` records a grant based on the file's (name × content) hash whereas `direnv deny` records a revocation based on the file's name alone. The reason behind this difference is so that `direnv` doesn't keep prompting the user to `direnv allow` a file if the file changes over time (e.g. the user pulls in new changes to the file from the repository origin). This change also includes some small fixes to not fail or emit a warning if a user runs `direnv allow` or `direnv deny` twice in a row. Before those fixes `direnv` would fail with an error message like: ``` direnv: error stat …/.local/share/direnv/allow/…: no such file or directory ``` … and after this change `direnv` will silently exit (successfully) if there is nothing to be done.
- Loading branch information
1 parent
f2fbec8
commit b80f567
Showing
2 changed files
with
102 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters