Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71927

Re: shebang & windows: call an extensionless git hook

References <1400777937.43633.YahooMailNeo@web163802.mail.gq1.yahoo.com>
Date 2014-05-23 06:53 -0700
From Albert-Jan Roskam <fomcl@yahoo.com>
Subject Re: shebang & windows: call an extensionless git hook
Newsgroups comp.lang.python
Message-ID <mailman.10244.1400853350.18130.python-list@python.org> (permalink)

Show all headers | View raw


----- Original Message -----
> From: Albert-Jan Roskam <fomcl@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: shebang & windows: call an extensionless git hook Albert-Jan Roskam <fomcl@yahoo.com> - 2014-05-23 06:53 -0700

csiph-web