From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Glen Choo" <chooglen@google.com>
Cc: git@vger.kernel.org, Adam Zethraeus <adam.zethraeus@includedhealth.com>
Subject: Re: bug report: pre-commit & pre-push hook output is redirected differently
Date: Wed, 06 Jul 2022 14:06:21 -0700 [thread overview]
Message-ID: <xmqqa69mgdde.fsf@gitster.g> (raw)
In-Reply-To: <CAP4e5TNdvE1gmt9bERT5sL+D3r4Fbypk57KJJ+wYHD=M=T+uWA@mail.gmail.com> (Adam Zethraeus's message of "Wed, 6 Jul 2022 13:40:45 -0700")
Adam Zethraeus <adam.zethraeus@includedhealth.com> writes:
> What did you do before the bug happened? (Steps to reproduce your issue)
>
> Installed identical pre-commit and pre-push hooks:
>
> ```
> #!/bin/bash
>
>>&1 echo "stdout"
>>&2 echo "stderr"
> exit 1
> ```
>
> What did you expect to happen? (Expected behavior)
>
> `git push` and `git commit` should have the same hook behavior.
>
> What happened instead? (Actual behavior)
>
> The pre-commit hook was run with stdout redirected to stderr but the
> pre-push hook's output was unaltered.
Without looking into it very much, the output of hooks is an area
with known regression at 2.36, so let me redirect it to those who
are likely to know it ;-)
Thanks for a report.
>
> ```
>> git commit -m "-" 1>/dev/null
> stdout
> stderr
>> git commit -m "-" 2>/dev/null
>> git commit -m "-" --no-verify
>> git push 1>/dev/null
> stderr
> error: failed to push some refs to 'github.com:org/repo.git'
>> git push 2>/dev/null
> stdout
> ```
>
> What's different between what you expected and what actually happened?
>
> There was inconsistency in the behavior when I expected consistency.
>
> Anything else you want to add:
>
> ```
>> /bin/bash --version
> GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)
> ```
>
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
>
>
> [System Info]
> git version:
> git version 2.37.0
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Darwin 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22
> PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
> compiler info: clang: 13.1.6 (clang-1316.0.21.2.5)
> libc info: no libc information available
> $SHELL (typically, interactive shell): /bin/zsh
>
>
> [Enabled Hooks]
> pre-commit
> pre-push
next prev parent reply other threads:[~2022-07-06 21:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-06 20:40 bug report: pre-commit & pre-push hook output is redirected differently Adam Zethraeus
2022-07-06 21:06 ` Junio C Hamano [this message]
2022-07-07 12:40 ` Ævar Arnfjörð Bjarmason
2022-07-07 16:57 ` Junio C Hamano
2022-07-07 20:55 ` Emily Shaffer
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqa69mgdde.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=adam.zethraeus@includedhealth.com \
--cc=avarab@gmail.com \
--cc=chooglen@google.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).