0

I'd like to run a function before magit runs git, and another one after magit runs git. I see magit-pre-start-git-hook but I don't see any post-finish-git hook. How can I run commands before and after magit runs git?

2
  • Your best bet is probably to write before advice for magit-process-finish (and to submit a feature request). Note also magit-pre-call-git-hook for synchronous calls. Be careful though -- the "pre" hook for the async case has no process object, and async processes might not finish in the order you started them.
    – phils
    Mar 2, 2019 at 20:53
  • Magit runs git a lot. Doing something every time that happens probably isn't a good idea. What do you want to accomplish?
    – tarsius
    Mar 20, 2019 at 0:08

1 Answer 1

1

Magit runs git a lot. Doing something every time that happens probably isn't a good idea. What do you want to accomplish?


That being said you can make Magit do something before running git by advising all or some of the functions that run git. I strongly recommend you only advice some of these functions or even just the commands that you actually want to do something before running git. I cannot tell you which functions you have to advice because you didn't say what you want to accomplish.

To find all functions that run git grep for magit-git-executable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.