git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Issue with git > 2.36.1 and pre-commit hook on macOS M1

From
René Scharfe <l.s.r@web.de>
Date
Dec 12, 2022, 13:29 UTC
Message-ID
<30f80aa4-d5c1-4fce-f1c9-710eabeaa022@web.de>
In-Reply-To
<51d5993f-a1e0-519e-ffa9-ec5205c5e96d@o2.pl>
Am 11.12.22 um 22:11 schrieb Piotrek:
Show 9 quoted lines
> 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é
Previous: PiotrekNext: Piotrek
Message 2 of 6 in “Issue with git > 2.36.1 and pre-commit hook on macOS M1”
  1. PiotrekDec 11, 2022
  2. René ScharfeDec 12, 2022
  3. PiotrekDec 13, 2022
  4. René ScharfeDec 14, 2022
  5. PiotrekDec 17, 2022
  6. René ScharfeDec 17, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.