another change of applying hooks: Find one hook for every branch of commit and apply it once.