GitPython icon indicating copy to clipboard operation
GitPython copied to clipboard

[windows] some hooks are tried to be executed even if there is no such a file

Open KOLANICH opened this issue 7 years ago • 5 comments

For example https://github.com/gitpython-developers/GitPython/blob/0857d33852b6b2f4d7bc470b4c97502c7f978180/git/index/base.py#L941

May be the cause of 703

KOLANICH avatar Jun 09 '18 21:06 KOLANICH

This is not true - it checks for accessibility inside that function.

Even though this ticket is closed, please feel free to state the underlying problem so people can chime in and help.

Byron avatar Jun 10 '18 18:06 Byron

This is not true - it checks for accessibility inside that function.

That's strange. Windows 7, 32-bit. On popen it fails with a window appearing saying that the hook file is not a win32 application. In fact there was no such a file at all in the hooks dir.

KOLANICH avatar Jun 12 '18 17:06 KOLANICH

It is strange indeed. If you can provide a simple python script that reproduces the issue, it truly is a bug worth fixing. Might just be very special behaviour on a OS whose tests are known to be broken for GitPython.

Byron avatar Jul 15 '18 12:07 Byron

If anyone is still following this, I had a similar error to this, but with run_commit_hook('post-commit', self) instead of pre-commit. What I have done to fix the error is to convert the post-commit file in .git folder to a .bat file. The error of the system complaining that the file is not a Win32 application comes from the fact that Windows doesn't like executing files. This resolution seems a little hacky to me, so if anyone has a better solution that would be great.

EricMoorman avatar Nov 03 '18 15:11 EricMoorman

I have reopened the issue on account of this seemingly happening on windows, which by now is an entirely untested platform, unfortunately.

Until there is a fix, one might try to use the skip_hooks=true flag when executing IndexFile.commit(...).

Byron avatar Dec 22 '18 13:12 Byron