fork-dev / Tracker

Bug and issue tracker for Fork for Mac
511 stars 12 forks source link

Pass expected parameters to prepare_commit_msg #1789

Open samdeane opened 1 year ago

samdeane commented 1 year ago

When the git command line runs prepare-commit-hook, it is passed up to three parameters (see https://git-scm.com/docs/githooks#_prepare_commit_msg).

It looks like that's currently not happening when Fork runs it. It would be helpful if it did happen, so that existing hook scripts worked as expected.

Extra information, such as the existing "subject" and "description" field values, could also be passed as environment variables, eg: FORK_SUBJECT, and FORK_DESCRIPTION.

This would be helpful as it would allow the script to know that it was running from Fork.app, and modify its behaviour accordingly (if required).

svoop commented 7 months ago

Indeed, the way Fork uses the prepare-commit-hook is currently incompatible with CLI Git:

The second argument contains the source of commit, either message, template, merge, squash or commit (which requires a third argument). IMO, only the first and the last of these are relevant for Fork.

Furtunately, it's not very difficult to make things compatible. Fork would have to...

/cc @DanPristupov