----- Original Message ----- > From: Albert-Jan Roskam <fo...@yahoo.com.dmarc.invalid> > To: Python <python-list@python.org> > Cc: > Sent: Thursday, May 22, 2014 6:58 PM > Subject: shebang & windows: call an extensionless git hook > > Hi, > > I wrote the git pre-commit hook below. It is supposed to reject commits that > contain large files (e.g. accidental commits by inexperienced users, think of > "git add .") > > > Anyway, I tried this under Linux, but the target platform is Windows. As per > Git > design the hook name *must* be "pre-commit" (no .py extension). How > will Windows know that Python should be run? And (should it be relevant): how > does Windows know which Python version to invoke? I read about custom > shebangs > with Pylauncher. Is that my only option? (see: > https://bitbucket.org/vinay.sajip/pylauncher, > http://legacy.python.org/dev/peps/pep-0397/)
Ok, I just found out that the script works as-is under Windows (I need to save it as 'pre-commit', not as 'pre-commit.py'. That's great, though I still don't understand how Windows (or Git) knows how to do with it. And under Windows chmod +x does not exist, which means the hook is always ready to be used. This is exactly what I want in this case, but in general this poses a security risk regards, Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list