Module git_branchless::commands::hooks
source · [−]Expand description
Callbacks for Git hooks.
Git uses “hooks” to run user-defined scripts after certain events. We extensively use these hooks to track user activity and e.g. decide if a commit should be considered obsolete.
The hooks are installed by the branchless init
command. This module
contains the implementations for the hooks.
Functions
For rebases, detect empty commits (which have probably been applied
upstream) and write them to the rewritten-list
file, so that they’re later
passed to the post-rewrite
hook.
Handle Git’s post-checkout
hook.
Handle Git’s post-commit
hook.
Handle Git’s post-merge
hook. It seems that Git doesn’t invoke the
post-commit
hook after a merge commit, so we need to handle this case
explicitly with another hook.
Handle Git’s post-rewrite
hook.
Handle Git’s reference-transaction
hook.
For rebases, register that extra cleanup actions should be taken when the
rebase finishes and calls the post-rewrite hook. We don’t want to change the
behavior of git rebase
itself, except when called via git-branchless
, so
that the user’s expectations aren’t unexpectedly subverted.
For rebases, if a commit is known to have been applied upstream, skip it without attempting to apply it.