fork-dev / TrackerWin

Bug and issue tracker for Fork for Windows
459 stars 10 forks source link

hooks in core.hooksPath cause different behavior #2092

Open frankbenoit opened 9 months ago

frankbenoit commented 9 months ago

I implement a pre-commit hook

Good case with repository local: I place the file <repo>.git/hooks/pre-commit On exit 1, Fork shows "Git error" with the output of the hook and a button "Skip pre-commit hooks and commit".

Bad case with global hook: Now I move the same pre-commit hook into my user home, ~/.githooks/pre-commit. The <repo>.git/hooks is empty. I register that directory globally: git config --global core.hooksPath '~/.githooks' On exit 1, Fork shows the same error dialog with the output from the hook, but the button "Skip pre-commit hooks and commit" is not shown.

Workaround: Create a empty dummy file in The <repo>.git/hooks/pre-commit. Now the button is shown again.

Please show the button also in the 2nd scenario without the need for the workaround.

FeBe95 commented 1 day ago

I've experienced the same issue today. Your workaround does indeed work, but a real fix would be very appreciated.

FeBe95 commented 1 day ago

I've found #771 from May 2020, where the same issue was reported. As of today, core.hooksPath is still the only way of making git hooks sharable with other participants of a repository. I would love to see this feature added to Fork, @DanPristupov, what do you think?

DanPristupov commented 1 day ago

@FeBe95 Yes, Fork should support this, but right now Fork itself doesn't read the global git config. Reading it is not a straightforward task because it would affect the overall application performance.

I don't have an ETA, but we may fix this in ~6 months.

FeBe95 commented 1 day ago

@DanPristupov Thanks for your answer and the (estimated) ETA!

FYI: In our repository we use a local config instead:

git config --local core.hooksPath .githooks/