# git apply and error

1 messages from 2020-01-14 to 2020-01-14. Participants: Kim NEVELSTEEN.
Thread: https://gitlist.dev/t/52632

## Kim NEVELSTEEN, 2020-01-14 13:12

Subject: git apply and error
Message-ID: <c8efd09f-c0a4-57b5-db5c-6a13143ebac0@nevelsteen.com>
URL: https://gitlist.dev/e/c8efd09f-c0a4-57b5-db5c-6a13143ebac0%40nevelsteen.com

```
Hello git community.

I have noticed some irregular output with "git apply".

When including git in a bash script, I noticed that "git apply" does not report an error when
failing because it is in a git repository.

Example:
QotD:home$ cd src
QotD:home/src$ git apply --stat --apply patch
 patch |   26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

Again:
QotD:home$ git init
QotD:home$ cd src
QotD:home/src$ git apply --stat --apply patch
 0 files changed

The problem is not that it doesn't work, but that no error is reported.

QotD:mcp940$ git apply --stat --apply patch || echo "ERROR"
<<nothing printed here>>

Cheers!
-KiM


```
