hijacking hooks broke my git
complete
R
Ross
After installing
trunk
, git rebase
would hang forever:$ GIT_TRACE=2 git rebase -i other-branch
13:36:42.905813 git.c:460 trace: built-in: git rebase -i other-branch
13:36:42.950107 run-command.c:1524 run_processes_parallel: preparing to run up to 1 tasks
13:36:42.950145 run-command.c:655 trace: run_command: /Users/Ross/.cache/trunk/repos/bcdba96019adf8e197586aa7271276fc/git-hooks/pre-rebase this-branch
Even if I remove trunk's hooks, trunk replaces it when I run
trunk check
.Sam Lijin
complete
Sounds like this is no longer an issue
Eli Schleifer
Hey Ross -
Apologies you are running into this problem. Some quick data would help us narrow done the repro:
- What version of trunk are you running?
- Comment out these two actions -
` - trunk-check-pre-push
- trunk-fmt-pre-commit`
from your trunk.yaml in the meantime.
R
Ross
Eli Schleifer:
trunk version
returns 1.3.1
and then hangs. Maybe that's a clue?Removing those lines don't seem to help. And there's some bugs here - for instance, I removed
trunk-fmt-pre-commit
and then trunk check -n
still hijacked core.hooksPath
even though it no longer told me it was doing it.Removing all actions by setting
actions:
enabled: []
does
fix it. But I'm not clear on whether or not that will break automated runs.Eli Schleifer
Ross: That's a great clue on the trunk version hanging.
If you remove the actions you will need to run
trunk check
manually and it won't be managed by githooks.Curious - if you
trunk upgrade
and then enable those actions back in - does it still hang?Eli Schleifer
Ross: One more note:
Alternatively if you like to live dangerously :) you can get onto the latest bleeding edge release to check that the bug still exists in our pre-release build
trunk upgrade --bleeding-edge
R
Ross
Eli Schleifer: yes, git rebase is no longer broken - thanks.
But I still don't want
trunk
to hijack my local git hooks. I tried disabling it user.yaml
, both in the repo .trunk/
and ~/.cache/trunk
- but it doesn't work.Just because something is useful in CI doesn't mean I want it on every commit.
Eli Schleifer
Ross: Totally makes sense - if you remove these actions
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
Then you're git hooks will not be affected. It is definitely an opt-in system and we'll make some tweaks in the setup to make it clearer
R
Ross
Eli Schleifer: for that to be effective, I have to do in the repo's trunk.yaml, right? and will that disable them for all developers and in github actions?
After some more playing around,
git-lfs
is what's silently enabling the hooks:$ trunk daemon shutdown
✔ Daemon stopped
$ git config --unset core.hooksPath
$ yq .actions .trunk/trunk.yaml
enabled:
- git-lfs
disabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available
$ trunk check -n
Checking 100% [=========================================================================================>] 23/23 0.4s
Checked 9 modified files
✔ No issues
$ git config --get core.hooksPath
/Users/Ross/.cache/trunk/repos/bcdba96019adf8e197586aa7271276fc/git-hooks