-
Notifications
You must be signed in to change notification settings - Fork 44
Issues 862 direnv fix #877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mohitrajain
wants to merge
4
commits into
master
Choose a base branch
from
issues-862-direnv-fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6949a01
issue-862: remove read to operate in .envrc
mohitrajain d1e53ff
issue-862: update readme.md and commit-msg to reflect new envrc behav…
mohitrajain efec0e9
issue-862: add changelog.d for direnv behaviour
mohitrajain 592e246
fix: change git-hook implementation based on envs in .envrc.local file
mohitrajain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,29 @@ | ||
| #!/bin/bash | ||
|
|
||
| read -p "Do you want to setup git commit hooks? (y/Y to continue): " response | ||
| if [[ "$response" =~ ^[yY]$ ]]; then | ||
| git config core.hooksPath .git-hooks | ||
| else | ||
| git config --unset core.hooksPath | ||
| fi | ||
|
|
||
| read -p "Do you want to continue with Nix operations? (y/Y to continue): " response | ||
| nix-build $PWD/default.nix -A env --out-link .nix-env | ||
|
|
||
| if [[ "$response" =~ ^[yY]$ ]]; then | ||
| nix-build $PWD/default.nix -A env --out-link .nix-env | ||
| PATH_add ".nix-env/bin" | ||
|
|
||
| PATH_add ".nix-env/bin" | ||
| export LOCALHOST_PYTHON="$PWD/.nix-env/bin/python" | ||
|
|
||
| export LOCALHOST_PYTHON="$PWD/.nix-env/bin/python" | ||
| # source .profile from `$env`. | ||
| # This is only used to set things interpolated by nix. | ||
| # All *static* things should live inside .envrc. | ||
| [[ -f ".nix-env/.profile" ]] && source_env ".nix-env/.profile" | ||
|
|
||
| # source .profile from `$env`. | ||
| # This is only used to set things interpolated by nix. | ||
| # All *static* things should live inside .envrc. | ||
| [[ -f ".nix-env/.profile" ]] && source_env ".nix-env/.profile" | ||
| # allow local .envrc overrides | ||
| [[ -f .envrc.local ]] && source_env .envrc.local | ||
|
|
||
| # allow local .envrc overrides | ||
| [[ -f .envrc.local ]] && source_env .envrc.local | ||
| if [[ "$NO_GIT_HOOKS" == "TRUE" ]]; then | ||
| # setting up .git-hooks for commit message verification | ||
| git config core.hooksPath .git-hooks | ||
|
|
||
| else | ||
| echo "Skipping Nix operations." | ||
| echo "" | ||
| echo " Git Hooks has been configured in your current environment." | ||
| echo " Read more about them here: https://github.com/wireapp/wire-server-deploy?tab=readme-ov-file#optional-git-commit-message-verification" | ||
| echo " If you don't want to use it, then set NO_GIT_HOOKS=FALSE in file .envrc.local and re-laod the envionment by running:" | ||
| echo " direnv reload" | ||
| echo "" | ||
| else | ||
| git config --unset core.hooksPath | ||
| fi |
This file contains hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fixed: remove read function to operate .envrc and updated the README.md |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: it's not really true, since the next
direnvrun will activate the hooks again.suggestion: If you want people to be able to opt out of git hooks altogether, you could invent something like a
NO_GIT_HOOKSenv var that one could put into.envrc.local(which is evaluated prior to setting up the hooks).Bear in mind I don't really understand your workflow and why being able to opt out of githooks is such a big deal - but in case validation breaks, people can always use
--no-verifywhen committing.Personally, I'm always happy if projects provide validation hooks, so I'd not even make a fuzz about disabling it 😅