git apply and error

From: Kim NEVELSTEEN <hidden>
Date: 2020-01-14 13:21:37

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help