git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Piotrek <piotrekkr@o2.pl>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git@vger.kernel.org
Subject: Re: Issue with git > 2.36.1 and pre-commit hook on macOS M1
Date: Mon, 12 Dec 2022 14:29:41 +0100	[thread overview]
Message-ID: <30f80aa4-d5c1-4fce-f1c9-710eabeaa022@web.de> (raw)
In-Reply-To: <51d5993f-a1e0-519e-ffa9-ec5205c5e96d@o2.pl>

Am 11.12.22 um 22:11 schrieb Piotrek:
> Hello.
>
> On MacOS 12.6.1 with M1 chip, git >=2.37.0 (installed by homebrew)
> and pre-commit hook that is calling *make* target, that is calling
> *docker compose run* command, we get error:
>
> the input device is not a TTY
>
> All works file with homebrew git version 2.36.1

Bisects to a082345372 (hook API: fix v2.36.0 regression: hooks should be
connected to a TTY, 2022-06-07).

Adding "for fd in 0 1 2; do test -t $fd; printf %d $?; done; echo" to
the shell script .git/hook/pre-commit yields 100 since a082345372, i.e.
fd 1 (stdout) and fd 2 (stderr) are associated with a terminal, while
fd 0 (stdin) is not.  Before we got 111, i.e. none of the standard file
descriptors were associated with a terminal.

v2.37.0 includes a082345372.  v2.35.0 gives 100 as well, as expected, so
older versions of Git should have "docker compose" complain as well.

While "docker compose" is right in that stdin is not a TTY, it never
was.  Redirecting the output its seems to help.  So I guess it checks if
stdout is connected to a terminal and then expects stdin to be a TTY as
well.  Try appending " | cat" to the command in the pre-commit hook,
which breaks the connection for stdout.

René

  reply	other threads:[~2022-12-12 13:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11 21:11 Issue with git > 2.36.1 and pre-commit hook on macOS M1 Piotrek
2022-12-12 13:29 ` René Scharfe [this message]
2022-12-13 21:02   ` Piotrek
2022-12-14 22:23     ` René Scharfe
2022-12-17  7:50       ` Piotrek
2022-12-17  8:34         ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30f80aa4-d5c1-4fce-f1c9-710eabeaa022@web.de \
    --to=l.s.r@web.de \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=piotrekkr@o2.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).