Discover in Git hook if git was called by Arcanist?

Hello! I have some git hooks that prevent commits directly to a release branch. I want these to exist, but they should be disabled when calling arc land. Is there a way to discover inside the hook that git was called by Arcanist? Or can Arcanist toggle hooks while running?

Thanks!

Are these hooks on the server or on the client?
If it’s in the server, re-implement them using Herald or move them according to https://secure.phabricator.com/book/phabricator/article/diffusion_hooks/.
If it’s in the client, then it won’t actually stop what you’re trying to prevent, and you should move them to the server anyway.

I don’t know of an easy way to figure out if a git command is executed from inside arc.

Try, within your git hook:

IS_ARC_LAND=$(pstree -a -s $PPID | grep -q "arcanist.php <land, diff, etc>"; echo $?)
1 Like