git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git apply and error

From
KNKim NEVELSTEEN <kim@nevelsteen.com>
Date
Jan 14, 2020, 13:12 UTC
Message-ID
<c8efd09f-c0a4-57b5-db5c-6a13143ebac0@nevelsteen.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

Message 1 of 1 in “git apply and error”
  1. Kim NEVELSTEENJan 14, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.