Support git hook new format, end of support of old distributions

Current situation

Git 2.54 introduced a new way to declare git hooks (and also other cool unrelated stuffs)

git-gamble's current implementation, manually executes git hooks file

Defining git-gamble's hook with the new format won't work

Objective

Support git hook new format inside git-gamble

Solutions

Ignore git hook new format

Easiest : nothing to do

Not cool to have a difference between git's hooks and git-gamble's hooks

Support new format

Hardest : reimplement how new hooks work

I would be complicated and not future-proof

Use internal git-hook run command

Since git 2.36, there is the command git-hook run

Using this command will make git-gamble will require git 2.36 or above which have been released in 2022-04-18

As the time of writing (2026-04-22), according to Repology, this would break old LTS distributions

Like :

Ignore LTS

Ignore old distributions

Use different strategies based on git's version

A detection of the git version could be done, to know which strategy to use :

  • git 2.54 or newer ⇒ use git hook run
  • else ⇒ manually execute file

But it would make the code more complicated for something that would eventually disappear

Add Cargo feature to disable git-gamble's hooks

Add a Cargo feature to remove all the hook related stuff at compilation

The feature would be enabled by default

The feature could be disabled and git-gamble recompiled to works on old distributions

Question

Does someone have ideas or better solution ?

Edited by pinage404