threads / discuss / 52632

git apply and error

Subject: git apply and error

## tl;dr

One message between Jan 14, 2020 and Jan 14, 2020.

replies: 0people: 1as markdown or json

Kim NEVELSTEEN· Jan 14, 2020, 13:12 UTC · lore
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

← back to recent threads