All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG?] applypatch-msg hook no-longer thinks stdin is a tty
@ 2015-10-01  3:42 Chris Packham
  2015-10-02 16:03 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Packham @ 2015-10-01  3:42 UTC (permalink / raw)
  To: GIT

Hi,

I have a applypatch-msg hook that implements some policy for
acceptable commit messages and reject non-conformant patches. It also
is able to prompt me to override it's rejection. The prompting only
happens when stdin is a tty (as determined by pythons
sys.stdin.isatty())

For example this would reject the patch and cause am stop
 $ cat bad.patch | git am

And this would prompt me to allow the patch and am would proceed if I answer Y
  $ git am bad.patch
  Patch message invalid apply (Y/N)?

As of git 2.6 this has stopped working and stdin always fails the tty
check. Here's a minimal reproduction

$ cat >.git/hooks/applypatch-msg <<EOF
#!/usr/bin/env python
import sys
if sys.stdin.isatty():
    print("TTY")
else:
    print("NOT")
EOF
$ chmod +x .git/hooks/applypatch-msg

$ git checkout -b temp origin/master^
$ git format-patch master -1

# With git 2.6
$ git am 0001-Git-2.6.patch
NOT
Applying: Git 2.6

# With git 2.5.3
TTY
Applying: Git 2.6

Thanks,
Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-03  9:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01  3:42 [BUG?] applypatch-msg hook no-longer thinks stdin is a tty Chris Packham
2015-10-02 16:03 ` Junio C Hamano
2015-10-02 17:43   ` Junio C Hamano
2015-10-03  7:37     ` Chris Packham
2015-10-03  9:08       ` Johannes Sixt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.