Replies: 4 comments 10 replies
|
There's no support for git hooks yet. Good point about updating the docs. I'll send a PR for that. Because the workflow in jj is quite different, some of the hooks don't seem to make much sense. For example, because we implicitly create commits from the working copy and/or without touching the working copy (e.g. when you change the description of an ancestor commit), Git's pre-commit hook would usually not make sense. I think even Git itself is considering skipping the pre-commit hook when rebasing, once they start doing it without touching the working copy. The post-commit doesn't make much sense either, since it also relies on HEAD being for the just-created commit. We could probably call the prepare-commit-msg hook. However, if the hook tries to inspect the working copy or Git's HEAD, it will typically not do what you want. Also, I just experimented a bit with it and the third "SHA1" argument it gets doesn't seem to actually be a SHA1 (it's been empty or the string "HEAD" in my experimentation). So maybe it only makes sense for jj to call it when the working copy is colocated with Git (i.e. created by Which hook(s) do you miss having support for? FWIW, I've planned to eventually add native (i.e. not Git-specific) hooks. There would be at least a transaction-level hook, which would let you inspect and approve the changes in a transaction (there's typically one transaction per command, plus maybe one more for snapshotting the working copy). |
|
Echoing the support to add support to some of the git-hooks. The ones I use that I believe fit well with jj's workflow:
|
|
It would've been awesome to have pre-commit hook. Linting/formatting the files that are being committed is an extremely useful feature |
|
I'd like the ability to add hooks around the workspace lifecycle. My use-case is I have ignored Being able to automatically run something after a workspace create (with input parameters containing the new workspace name/directory) would allow me to automate this. |
Uh oh!
There was an error while loading. Please reload this page.
Does
jjhave support for either git hooks or a similar mechanism?https://github.com/martinvonz/jj/blob/main/docs/git-compatibility.md doesn't seem to mention this one way or the other, so it'd be nice if it were discussed there even if the answer is no for now.
All reactions