bug report: pre-commit & pre-push hook output is redirected differently

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

```
> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux