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


Groups > comp.lang.python > #71927 > unrolled thread

Re: shebang & windows: call an extensionless git hook

Started byAlbert-Jan Roskam <fomcl@yahoo.com>
First post2014-05-23 06:53 -0700
Last post2014-05-23 06:53 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#71927 — Re: shebang & windows: call an extensionless git hook

FromAlbert-Jan Roskam <fomcl@yahoo.com>
Date2014-05-23 06:53 -0700
SubjectRe: shebang & windows: call an extensionless git hook
Message-ID<mailman.10244.1400853350.18130.python-list@python.org>
----- 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web