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

Re: [PATCH 2/2] filter-branch: fail gracefully when a filter fails

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 6, 2007, 08:33 UTC
Message-ID
<7vir8yextt.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<863b02j6qs.fsf@lola.quinscape.zz>
David Kastrup <dak@gnu.org> writes:
Show 8 quoted lines
> Instead of "grep ." one could also do something like
>
> if read line then
>   while echo "$line" && read line; do :; done
>   die
> fi
>
> which is fork-less.

I'd agree with you that "grep ^" would be preferable _if_ we were to do this. But in your fork-less example, you are assuming that (1) "read" does not molest what is read, (2) "echo" is built-in, and (3) "echo" does not munge the parameter.

Since I am one of old fashioned shell people (I readily admit that I used to have _fun_ with autoconf generated shell scripts), I'd love to continue shell skill show-offs, but for the purpose of updating this script, I would say a temporary file is much better than any of the alternatives around 1>&3. For one thing, it would make debugging the script while developing and tweaking it, _and_ while using it, much more pleasant.

Previous: David KastrupNext: Jeff King
Message 7 of 10 in “filter-branch: fail gracefully when a filter fails”
  1. 2/2 filter-branch: fail gracefully when a filter failsJohannes Schindelin, Jul 4, 2007
  2. Jeff KingJul 5, 2007
  3. Johannes SchindelinJul 5, 2007
  4. Junio C HamanoJul 5, 2007
  5. Johannes SixtJul 6, 2007
  6. David KastrupJul 6, 2007
  7. Junio C HamanoJul 6, 2007
  8. Jeff KingJul 6, 2007
  9. Josh TriplettJul 6, 2007
  10. Johannes SchindelinJul 6, 2007

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.