Why doesn't git-revert cause pre-commit and commit-msg locks?

Using strace, I noticed that git-revert only calls two hooks:

  • prepare commit messages
  • after fixation

But git-commit will call these four:

  • before fixing
  • prepare commit messages
  • commit-message
  • after fixation

Since git-revert creates a commit, why doesn't it call the same hooks as git-commit?

I asked this on the Git mailing list but did not receive a response. Therefore, I ask here.

I ended up researching this when I implemented a hook to detect and deny commits that return merge-commits because they are problematic .

I tried to implement it as a commit-msg hook to search for the string "This returns SHA-1" in the commit message. But git-revert does not call hook-commit-msg.

, . , pre-commit commit-msg, , .

+4
1

git commit . (. ) :

    if (!(flags & VERIFY_MSG))
            argv_array_push(&cmd.args, "-n");

, git commit -n . -n:

pre-commit commit-msg

git commit. , VERIFY_MSG, - "" "" , git cherry-pick.

, , ( ), . , , , , , .

+2

Source: https://habr.com/ru/post/1693795/


All Articles